All of lore.kernel.org
 help / color / mirror / Atom feed
* dm-snap deadlock in pending_complete()
@ 2015-08-10  3:55 NeilBrown
  2015-08-11  9:14 ` Mikulas Patocka
  0 siblings, 1 reply; 11+ messages in thread
From: NeilBrown @ 2015-08-10  3:55 UTC (permalink / raw)
  To: Mikulas Patocka, dm-devel


Hi Mikulas,
 I have a customer hitting the deadlock you described over a year ago
 in:

Subject: [dm-devel] [PATCH] block: flush queued bios when the process
         blocks

I notice that patch never went upstream.

Has anything else been done to fix this deadlock?

My thought was that something like the below would be sufficient.  Do
you see any problem with that?  It avoids the deadlock by dropping the
lock while sleeping.

Thanks
NeilBrown

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 7c82d3ccce87..d29bcd02f9cf 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1454,6 +1454,7 @@ static void pending_complete(struct dm_snap_pending_exception *pe, int success)
 	}
 	*e = pe->e;
 
+retry:
 	down_write(&s->lock);
 	if (!s->valid) {
 		free_completed_exception(e);
@@ -1462,7 +1463,11 @@ static void pending_complete(struct dm_snap_pending_exception *pe, int success)
 	}
 
 	/* Check for conflicting reads */
-	__check_for_conflicting_io(s, pe->e.old_chunk);
+	if (__chunk_size_tracked(s, pe->e.old_chunk)) {
+		up_write(&s->lock);
+		msleep(1);
+		goto retry;
+	}
 
 	/*
 	 * Add a proper exception, and remove the

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-08-18  6:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-10  3:55 dm-snap deadlock in pending_complete() NeilBrown
2015-08-11  9:14 ` Mikulas Patocka
2015-08-12  1:46   ` NeilBrown
2015-08-12 14:16     ` Mikulas Patocka
2015-08-13  1:23       ` NeilBrown
2015-08-17 10:55         ` Mikulas Patocka
2015-08-12 16:25     ` Mikulas Patocka
2015-08-13  0:43       ` NeilBrown
2015-08-13 14:02         ` Mike Snitzer
2015-08-17 13:48         ` Mikulas Patocka
2015-08-18  6:29           ` NeilBrown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.