public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6/9] device-mapper snapshot: barriers not supported
@ 2006-01-20 21:17 Alasdair G Kergon
  2006-01-23  5:41 ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Alasdair G Kergon @ 2006-01-20 21:17 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

The snapshot and origin targets are incapable of handling barriers and 
need to indicate this.

Signed-Off-By: Alasdair G Kergon <agk@redhat.com>

Index: linux-2.6.16-rc1/drivers/md/dm-snap.c
===================================================================
--- linux-2.6.16-rc1.orig/drivers/md/dm-snap.c
+++ linux-2.6.16-rc1/drivers/md/dm-snap.c
@@ -792,6 +792,9 @@ static int snapshot_map(struct dm_target
 	if (!s->valid)
 		return -EIO;
 
+	if (unlikely(bio_barrier(bio)))
+		return -EOPNOTSUPP;
+
 	/*
 	 * Write to snapshot - higher level takes care of RW/RO
 	 * flags so we should only get this if we are
@@ -1058,6 +1061,9 @@ static int origin_map(struct dm_target *
 	struct dm_dev *dev = (struct dm_dev *) ti->private;
 	bio->bi_bdev = dev->bdev;
 
+	if (unlikely(bio_barrier(bio)))
+		return -EOPNOTSUPP;
+
 	/* Only tell snapshots if this is a write */
 	return (bio_rw(bio) == WRITE) ? do_origin(dev, bio) : 1;
 }

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

* Re: [PATCH 6/9] device-mapper snapshot: barriers not supported
  2006-01-20 21:17 [PATCH 6/9] device-mapper snapshot: barriers not supported Alasdair G Kergon
@ 2006-01-23  5:41 ` Andrew Morton
  2006-01-23 15:56   ` Lars Marowsky-Bree
  2006-01-23 17:01   ` Alasdair G Kergon
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew Morton @ 2006-01-23  5:41 UTC (permalink / raw)
  To: Alasdair G Kergon; +Cc: linux-kernel

Alasdair G Kergon <agk@redhat.com> wrote:
>
> The snapshot and origin targets are incapable of handling barriers and 
>  need to indicate this.
> 
> ...
>   
>  +	if (unlikely(bio_barrier(bio)))
>  +		return -EOPNOTSUPP;
>  +

And what was happening if people _were_ sending such BIOs down?  Did it all
appear to work correctly?  If so, will this change cause
currently-apparently-working setups to stop working?

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

* Re: [PATCH 6/9] device-mapper snapshot: barriers not supported
  2006-01-23  5:41 ` Andrew Morton
@ 2006-01-23 15:56   ` Lars Marowsky-Bree
  2006-01-23 21:14     ` Andrew Morton
  2006-01-23 17:01   ` Alasdair G Kergon
  1 sibling, 1 reply; 6+ messages in thread
From: Lars Marowsky-Bree @ 2006-01-23 15:56 UTC (permalink / raw)
  To: Andrew Morton, Alasdair G Kergon; +Cc: linux-kernel

On 2006-01-22T21:41:11, Andrew Morton <akpm@osdl.org> wrote:

> Alasdair G Kergon <agk@redhat.com> wrote:
> >
> > The snapshot and origin targets are incapable of handling barriers and 
> >  need to indicate this.
> > 
> > ...
> >   
> >  +	if (unlikely(bio_barrier(bio)))
> >  +		return -EOPNOTSUPP;
> >  +
> 
> And what was happening if people _were_ sending such BIOs down?  Did it all
> appear to work correctly?  If so, will this change cause
> currently-apparently-working setups to stop working?

Filesystems basically disable using barriers on a device which doesn't
support them, which is indicated by -EOPNOTSUPP. Barriers are allowed to
fail in such fashion.

Now the interesting question is what happens when barriers are suddenly
verboten on a stack which used to support them - because the new mapping
doesn't support it _anymore_. Hrm. _Should_ work, but probably not
tested much ;-)


Sincerely,
    Lars Marowsky-Brée

-- 
High Availability & Clustering
SUSE Labs, Research and Development
SUSE LINUX Products GmbH - A Novell Business	 -- Charles Darwin
"Ignorance more frequently begets confidence than does knowledge"


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

* Re: [PATCH 6/9] device-mapper snapshot: barriers not supported
  2006-01-23  5:41 ` Andrew Morton
  2006-01-23 15:56   ` Lars Marowsky-Bree
@ 2006-01-23 17:01   ` Alasdair G Kergon
  1 sibling, 0 replies; 6+ messages in thread
From: Alasdair G Kergon @ 2006-01-23 17:01 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

On Sun, Jan 22, 2006 at 09:41:11PM -0800, Andrew Morton wrote:
> Alasdair G Kergon <agk@redhat.com> wrote:
> > The snapshot and origin targets are incapable of handling barriers and 
> >  need to indicate this.

> And what was happening if people _were_ sending such BIOs down?  Did it all
> appear to work correctly?  

The snapshot target ignores the barrier and in some circumstances I/O can be
reordered in ways that are meant to be prevented by the barrier.

> If so, will this change cause
> currently-apparently-working setups to stop working?

As Lars pointed out, filesystems should already cope with -EOPNOTSUPP 
transparently, and it would be sensible for any out-of-tree users to 
do likewise.

Alasdair
-- 
agk@redhat.com

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

* Re: [PATCH 6/9] device-mapper snapshot: barriers not supported
  2006-01-23 15:56   ` Lars Marowsky-Bree
@ 2006-01-23 21:14     ` Andrew Morton
  2006-01-25 20:55       ` Alasdair G Kergon
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2006-01-23 21:14 UTC (permalink / raw)
  To: Lars Marowsky-Bree; +Cc: agk, linux-kernel

Lars Marowsky-Bree <lmb@suse.de> wrote:
>
> On 2006-01-22T21:41:11, Andrew Morton <akpm@osdl.org> wrote:
> 
> > Alasdair G Kergon <agk@redhat.com> wrote:
> > >
> > > The snapshot and origin targets are incapable of handling barriers and 
> > >  need to indicate this.
> > > 
> > > ...
> > >   
> > >  +	if (unlikely(bio_barrier(bio)))
> > >  +		return -EOPNOTSUPP;
> > >  +
> > 
> > And what was happening if people _were_ sending such BIOs down?  Did it all
> > appear to work correctly?  If so, will this change cause
> > currently-apparently-working setups to stop working?
> 
> Filesystems basically disable using barriers on a device which doesn't
> support them, which is indicated by -EOPNOTSUPP. Barriers are allowed to
> fail in such fashion.
> 
> Now the interesting question is what happens when barriers are suddenly
> verboten on a stack which used to support them - because the new mapping
> doesn't support it _anymore_. Hrm. _Should_ work, but probably not
> tested much ;-)
> 

I don't understand that, sorry.

My concern is: has the above change any potential to cause
currently-working setups to stop working?


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

* Re: [PATCH 6/9] device-mapper snapshot: barriers not supported
  2006-01-23 21:14     ` Andrew Morton
@ 2006-01-25 20:55       ` Alasdair G Kergon
  0 siblings, 0 replies; 6+ messages in thread
From: Alasdair G Kergon @ 2006-01-25 20:55 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Lars Marowsky-Bree, linux-kernel

On Mon, Jan 23, 2006 at 01:14:46PM -0800, Andrew Morton wrote:
> Lars Marowsky-Bree <lmb@suse.de> wrote:
> > Now the interesting question is what happens when barriers are suddenly
> > verboten on a stack which used to support them - because the new mapping
> > doesn't support it _anymore_. Hrm. _Should_ work, but probably not
> > tested much ;-)

> I don't understand that, sorry.
 
> My concern is: has the above change any potential to cause
> currently-working setups to stop working?
 
I trust not.  Various things don't support barriers yet, so code 
shouldn't assume that they are supported.  Where they are supported,
they allow for optimisation.


For example, jbd detects the error and retries without them.

  fs/jbd/commit.c: static int journal_write_commit_record(

        if (ret == -EOPNOTSUPP && barrier_done) {
		... 
                printk(KERN_WARNING
                        "JBD: barrier-based sync failed on %s - "
                        "disabling barriers\n",
                        bdevname(journal->j_dev, b));
		...
		/* And try again, without the barrier */
		...

Alasdair
-- 
agk@redhat.com

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

end of thread, other threads:[~2006-01-25 20:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-20 21:17 [PATCH 6/9] device-mapper snapshot: barriers not supported Alasdair G Kergon
2006-01-23  5:41 ` Andrew Morton
2006-01-23 15:56   ` Lars Marowsky-Bree
2006-01-23 21:14     ` Andrew Morton
2006-01-25 20:55       ` Alasdair G Kergon
2006-01-23 17:01   ` Alasdair G Kergon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox