diff options
authorLars Ellenberg <>2015-04-16 16:51:34 +0200
committerJens Axboe <>2015-11-25 09:22:02 -0700
commit5bded4effb601d9f92382db38fd501f98692eb2d (patch)
parentbb649b34dd3d8f69308f5f193cb64457069c7222 (diff)
drbd: don't block forever in disconnect during resync if fencing=r-a-stonith
Disconnect should wait for pending bitmap IO. But if that bitmap IO is not happening, because it is waiting for pending application IO, and there is no progress, because the fencing policy suspended application IO because of the disconnect, then we deadlock. The bitmap writeout in this case does not care for concurrent application IO, so there is no point waiting for it. Signed-off-by: Philipp Reisner <> Signed-off-by: Lars Ellenberg <> Signed-off-by: Jens Axboe <>
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 136fa733a15e..5b43dfb79819 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -3563,7 +3563,9 @@ void drbd_queue_bitmap_io(struct drbd_device *device,
set_bit(BITMAP_IO, &device->flags);
- if (atomic_read(&device->ap_bio_cnt) == 0) {
+ /* don't wait for pending application IO if the caller indicates that
+ * application IO does not conflict anyways. */
+ if (flags == BM_LOCKED_CHANGE_ALLOWED || atomic_read(&device->ap_bio_cnt) == 0) {
if (!test_and_set_bit(BITMAP_IO_QUEUED, &device->flags))