Skip to contentSkip to conversation

dm_crypt: Issue all previous bios before remapping barrier bio

PATCH In review Nikanth Karthikesan 3 participants 4 messages Feb 1, 2010 – Feb 3, 2010 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm_crypt: Issue all previous bios before remapping barrier bio

Before remapping a barrier bio, make sure that there are no un-issued pending I/O in the workqueue. Otherwise a dm_flush would simply add a barrier request to the underlying device, without issuing the bio's queued in the dm_crypt device.

--

drivers/md/dm-crypt.c +1 -0
index a936372..be68e70 100644
@@ -1252,6 +1252,7 @@ static int crypt_map(struct dm_target *ti, struct bio *bio,
 
 	if (unlikely(bio_empty_barrier(bio))) {
 		cc = ti->private;
+		flush_workqueue(cc->io_queue);
 		bio->bi_bdev = cc->dev->bdev;
 		return DM_MAPIO_REMAPPED;
 	}
#1 lore raw
Quoted 4 lines · Nikanth Karthikesan

Before remapping a barrier bio, make sure that there are no un-issued pending I/O in the workqueue. Otherwise a dm_flush would simply add a barrier request to the underlying device, without issuing the bio's queued in the dm_crypt device.

This should not be needed. Core dm code waits for all bios submitted before barrier requests.

Mikulas, could you verify it?

Milan

maintainer
#2 lore raw
Quoted 6 lines · Milan Broz
Quoted 4 lines · Nikanth Karthikesan

Before remapping a barrier bio, make sure that there are no un-issued pending I/O in the workqueue. Otherwise a dm_flush would simply add a barrier request to the underlying device, without issuing the bio's queued in the dm_crypt device.

Quoted 6 lines

This should not be needed. Core dm code waits for all bios submitted before barrier requests.

Mikulas, could you verify it?

Milan

Yes, you are right, the patch is not needed.

When the target receives an empty barrier request, there are no other data requests in flight.

BTW. The target may receive more empty barrier requests simultaneously, if it asked for it by setting ti->num_flush_requests to more than one. But barrier and non-barrier requests are never mixed.

Mikulas

#3 lore raw
Quoted 14 lines · On Tuesday 02 February 2010 18:17:24 Mikulas Patocka wrote:
Quoted 6 lines · Milan Broz
Quoted 4 lines · Nikanth Karthikesan

Before remapping a barrier bio, make sure that there are no un-issued pending I/O in the workqueue. Otherwise a dm_flush would simply add a barrier request to the underlying device, without issuing the bio's queued in the dm_crypt device.

Quoted 6 lines

This should not be needed. Core dm code waits for all bios submitted before barrier requests.

Mikulas, could you verify it?

Milan

Quoted 9 lines

Yes, you are right, the patch is not needed.

When the target receives an empty barrier request, there are no other data requests in flight.

BTW. The target may receive more empty barrier requests simultaneously, if it asked for it by setting ti->num_flush_requests to more than one. But barrier and non-barrier requests are never mixed.

Correct. Sorry, I was a bit hasty in sending that patch. It is not required. Thanks for the patient explanation.

Thanks
Nikanth