summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2009-12-28 18:58:38 +0300
committerPhilipp Reisner <philipp.reisner@linbit.com>2009-12-29 19:36:40 +0300
commit0a6dbf2bc4ea3781c530f895e2d92fd3c4a735a2 (patch)
tree0918d5f492e456f20dfb668a3d885cabc1257920 /drivers/block
parent0798219f6154baa6a8efe767bfffb4a724e4b1e1 (diff)
downloadlinux-0a6dbf2bc4ea3781c530f895e2d92fd3c4a735a2.tar.xz
drbd: Fix for a race between IO and a detach operation [Bugz 262]
In D_DISKLESS we do not hand out any new references to ldev (local_cnt) therefore waiting until all previously handed out refereces got returned is sufficient before actually freeing mdev->ldev. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/drbd/drbd_main.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 9348f33f6242..e898ad9eb1c3 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -1298,6 +1298,7 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
dev_err(DEV, "Sending state in drbd_io_error() failed\n");
}
+ wait_event(mdev->misc_wait, !atomic_read(&mdev->local_cnt));
lc_destroy(mdev->resync);
mdev->resync = NULL;
lc_destroy(mdev->act_log);