From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Heinz Mauelshagen <heinzm@redhat.com>,
Mike Snitzer <msnitzer@redhat.com>,
dm-devel@redhat.com, "Alasdair G. Kergon" <agk@redhat.com>,
Zdenek Kabelac <zkabelac@redhat.com>
Subject: Re: [PATCH] dm-mirror: do not degrade the mirror on discard error
Date: Mon, 16 Feb 2015 06:27:24 -0800 [thread overview]
Message-ID: <1424096844.2089.2.camel@HansenPartnership.com> (raw)
In-Reply-To: <alpine.LRH.2.02.1502160742030.14038@file01.intranet.prod.int.rdu2.redhat.com>
On Mon, 2015-02-16 at 07:44 -0500, Mikulas Patocka wrote:
>
> On Sat, 14 Feb 2015, James Bottomley wrote:
>
> > On Thu, 2015-02-12 at 10:09 -0500, Mikulas Patocka wrote:
> > > It may be possible that a device claims discard support but it rejects
> > > discards with -EOPNOTSUPP. It happens when using loopback on ext2/ext3
> > > filesystem driven by the ext4 driver. It may also happen if the underlying
> > > devices are moved from one disk on another.
> > >
> > > If discard error happens, we reject the bio with -EOPNOTSUPP, but we do
> > > not degrade the array.
> > >
> > > This patch fixes failed test shell/lvconvert-repair-transient.sh in the
> > > lvm2 testsuite if the testsuite is extracted on an ext2 or ext3 filesystem
> > > and it is being driven by the ext4 driver.
> > >
> > > Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> > >
> > > Index: linux-2.6/drivers/md/dm-raid1.c
> > > ===================================================================
> > > --- linux-2.6.orig/drivers/md/dm-raid1.c
> > > +++ linux-2.6/drivers/md/dm-raid1.c
> > > @@ -604,6 +604,15 @@ static void write_callback(unsigned long
> > > return;
> > > }
> > >
> > > + /*
> > > + * If the bio is discard, return an error, but do not
> > > + * degrade the array.
> > > + */
> > > + if (bio->bi_rw & REQ_DISCARD) {
> > > + bio_endio(bio, -EOPNOTSUPP);
> >
> > I think the error gets ignored, so this is probably harmless, but
> > shouldn't you propagate the actual error here? discard is advisory and
> > can fail for a variety of reasons (alignment being chief) for which
> > EOPNOTSUPP is inappropriate.
> >
> > James
>
> dm-io doesn't pass the error code to the callback, it only returns the
> bitmask of failed devices. So, it is impossible to find the real error
> code.
I already said this in the first sentence of the last paragraph of my
email. The point isn't what it does today it's what might happen
tomorrow and the principle of least surprise. One day, someone might
propagate the error. When that happens, they'll be surprised to find
every discard failure reported as -ENOTSUPP and it will cost someone
time and effort to investigate and fix. If you just propagate the error
today, you save all that work in the future.
James
next prev parent reply other threads:[~2015-02-16 14:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-12 15:09 [PATCH] dm-mirror: do not degrade the mirror on discard error Mikulas Patocka
2015-02-12 15:43 ` Mikulas Patocka
2015-02-15 2:39 ` James Bottomley
2015-02-15 3:36 ` Mike Snitzer
2015-02-16 12:44 ` [PATCH] " Mikulas Patocka
2015-02-16 14:27 ` James Bottomley [this message]
2015-02-17 19:59 ` Mikulas Patocka
2015-02-18 15:16 ` James Bottomley
2015-02-18 16:29 ` Mikulas Patocka
2015-02-18 17:10 ` Mike Snitzer
2015-02-18 17:54 ` James Bottomley
2015-02-18 18:21 ` Mike Snitzer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424096844.2089.2.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=heinzm@redhat.com \
--cc=mpatocka@redhat.com \
--cc=msnitzer@redhat.com \
--cc=zkabelac@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.