summaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_main.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2010-11-16 15:30:44 +0100
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 11:35:03 +0100
commit22afd7ee94c1c5857323b677267ba8bace09bcef (patch)
tree4c704ede7399dfdd8bfba9dd7af0518a5cdeb691 /drivers/block/drbd/drbd_main.c
parent8869d683b7491467fd39fcbe79756fce3e6f35e7 (diff)
drbd: Fixed race condition in drbd_queue_bitmap_io
May only test for ap_bio_cnt == 0 under req_lock. It can increase only under req_lock. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_main.c')
-rw-r--r--drivers/block/drbd/drbd_main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 843b9096692..975dc5a6654 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -3849,11 +3849,13 @@ void drbd_queue_bitmap_io(struct drbd_conf *mdev,
mdev->bm_io_work.done = done;
mdev->bm_io_work.why = why;
+ spin_lock_irq(&mdev->req_lock);
set_bit(BITMAP_IO, &mdev->flags);
if (atomic_read(&mdev->ap_bio_cnt) == 0) {
if (!test_and_set_bit(BITMAP_IO_QUEUED, &mdev->flags))
drbd_queue_work(&mdev->data.work, &mdev->bm_io_work.w);
}
+ spin_unlock_irq(&mdev->req_lock);
}
/**