summaryrefslogtreecommitdiff
path: root/drivers/block/drbd/drbd_worker.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2011-11-10 11:12:52 (GMT)
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 15:58:05 (GMT)
commit0cfac5dd904ec8b376beb27f6ad265b12d71bf9e (patch)
tree91f100e963ae038e7bc410eb0b4ba7beb61eae72 /drivers/block/drbd/drbd_worker.c
parent376694a0543f5da194d9c6e102cfcd023ffac949 (diff)
downloadlinux-fsl-qoriq-0cfac5dd904ec8b376beb27f6ad265b12d71bf9e.tar.xz
drbd: Fixes from the drbd-8.3 branch
* drbd-8.3: drbd: fix spurious meta data IO "error" drbd: Fixed a race condition between detach and start of resync drbd: fix harmless race to not trigger an ASSERT drbd: Derive sync-UUIDs only from the bitmap-uuid if it is non-zero drbd: Fixed current UUID generation (regression introduced recently, after 8.3.11) 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_worker.c')
-rw-r--r--drivers/block/drbd/drbd_worker.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index 34a6065..bc2cfd6 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -74,10 +74,21 @@ void drbd_md_io_complete(struct bio *bio, int error)
md_io->error = error;
+ /* We grabbed an extra reference in _drbd_md_sync_page_io() to be able
+ * to timeout on the lower level device, and eventually detach from it.
+ * If this io completion runs after that timeout expired, this
+ * drbd_md_put_buffer() may allow us to finally try and re-attach.
+ * During normal operation, this only puts that extra reference
+ * down to 1 again.
+ * Make sure we first drop the reference, and only then signal
+ * completion, or we may (in drbd_al_read_log()) cycle so fast into the
+ * next drbd_md_sync_page_io(), that we trigger the
+ * ASSERT(atomic_read(&mdev->md_io_in_use) == 1) there.
+ */
+ drbd_md_put_buffer(mdev);
md_io->done = 1;
wake_up(&mdev->misc_wait);
bio_put(bio);
- drbd_md_put_buffer(mdev);
put_ldev(mdev);
}
@@ -1581,12 +1592,13 @@ void drbd_start_resync(struct drbd_conf *mdev, enum drbd_conns side)
}
clear_bit(B_RS_H_DONE, &mdev->flags);
+ write_lock_irq(&global_state_lock);
if (!get_ldev_if_state(mdev, D_NEGOTIATING)) {
+ write_unlock_irq(&global_state_lock);
mutex_unlock(mdev->state_mutex);
return;
}
- write_lock_irq(&global_state_lock);
ns = drbd_read_state(mdev);
ns.aftr_isp = !_drbd_may_sync_now(mdev);