Commit 22afd7ee authored by Philipp Reisner's avatar Philipp Reisner

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: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 8869d683
...@@ -3849,11 +3849,13 @@ void drbd_queue_bitmap_io(struct drbd_conf *mdev, ...@@ -3849,11 +3849,13 @@ void drbd_queue_bitmap_io(struct drbd_conf *mdev,
mdev->bm_io_work.done = done; mdev->bm_io_work.done = done;
mdev->bm_io_work.why = why; mdev->bm_io_work.why = why;
spin_lock_irq(&mdev->req_lock);
set_bit(BITMAP_IO, &mdev->flags); set_bit(BITMAP_IO, &mdev->flags);
if (atomic_read(&mdev->ap_bio_cnt) == 0) { if (atomic_read(&mdev->ap_bio_cnt) == 0) {
if (!test_and_set_bit(BITMAP_IO_QUEUED, &mdev->flags)) if (!test_and_set_bit(BITMAP_IO_QUEUED, &mdev->flags))
drbd_queue_work(&mdev->data.work, &mdev->bm_io_work.w); drbd_queue_work(&mdev->data.work, &mdev->bm_io_work.w);
} }
spin_unlock_irq(&mdev->req_lock);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment