All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm_crypt: Issue all previous bios before remapping barrier bio
@ 2010-02-01 15:19 Nikanth Karthikesan
  2010-02-01 15:39 ` Milan Broz
  0 siblings, 1 reply; 4+ messages in thread
From: Nikanth Karthikesan @ 2010-02-01 15:19 UTC (permalink / raw)
  To: dm-devel; +Cc: Alasdair G Kergon, Milan Broz

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.

Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>

--

diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index a936372..be68e70 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -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;
 	}

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

* Re: [PATCH] dm_crypt: Issue all previous bios before remapping barrier bio
  2010-02-01 15:19 [PATCH] dm_crypt: Issue all previous bios before remapping barrier bio Nikanth Karthikesan
@ 2010-02-01 15:39 ` Milan Broz
  2010-02-02 12:47   ` Mikulas Patocka
  0 siblings, 1 reply; 4+ messages in thread
From: Milan Broz @ 2010-02-01 15:39 UTC (permalink / raw)
  To: Nikanth Karthikesan; +Cc: dm-devel, Mikulas Patocka, Alasdair G Kergon

On 02/01/2010 04:19 PM, Nikanth Karthikesan wrote:
> 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

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

* Re: [PATCH] dm_crypt: Issue all previous bios before remapping barrier bio
  2010-02-01 15:39 ` Milan Broz
@ 2010-02-02 12:47   ` Mikulas Patocka
  2010-02-03  6:09     ` Nikanth Karthikesan
  0 siblings, 1 reply; 4+ messages in thread
From: Mikulas Patocka @ 2010-02-02 12:47 UTC (permalink / raw)
  To: device-mapper development; +Cc: Nikanth Karthikesan, Alasdair G Kergon

On Mon, 1 Feb 2010, Milan Broz wrote:

> On 02/01/2010 04:19 PM, Nikanth Karthikesan wrote:
> > 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

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

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

* Re: [PATCH] dm_crypt: Issue all previous bios before remapping barrier bio
  2010-02-02 12:47   ` Mikulas Patocka
@ 2010-02-03  6:09     ` Nikanth Karthikesan
  0 siblings, 0 replies; 4+ messages in thread
From: Nikanth Karthikesan @ 2010-02-03  6:09 UTC (permalink / raw)
  To: Mikulas Patocka; +Cc: device-mapper development, Alasdair G Kergon

On Tuesday 02 February 2010 18:17:24 Mikulas Patocka wrote:
> On Mon, 1 Feb 2010, Milan Broz wrote:
> > On 02/01/2010 04:19 PM, Nikanth Karthikesan wrote:
> > > 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
> 
> 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

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

end of thread, other threads:[~2010-02-03  6:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-01 15:19 [PATCH] dm_crypt: Issue all previous bios before remapping barrier bio Nikanth Karthikesan
2010-02-01 15:39 ` Milan Broz
2010-02-02 12:47   ` Mikulas Patocka
2010-02-03  6:09     ` Nikanth Karthikesan

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.