From: NeilBrown <neilb@suse.de>
To: Paul Clements <paul.clements@us.sios.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: [BUG 2.6.32] md/raid1: barrier disabling does not work correctly in all cases
Date: Wed, 2 Feb 2011 11:32:15 +1100 [thread overview]
Message-ID: <20110202113215.3e106ccb@notabene.brown> (raw)
In-Reply-To: <AANLkTimS00pyoN2f4E-2ZbSLq8-Xar3oj9DZ2sEfXzgs@mail.gmail.com>
On Tue, 1 Feb 2011 15:45:16 -0500 Paul Clements <paul.clements@us.sios.com>
wrote:
> On Wed, Jan 26, 2011 at 8:55 AM, Paul Clements
> <paul.clements@us.sios.com> wrote:
>
> > Attached is a modified patch, which does the extra necessary work
> > (bitmap_endwrite, md_write_end) on the bio before failing it.
> >
> > Does this look correct? It seems to work.
>
> Well, not quite...it's more complicated. From my reading of the code,
> it looks like behind writes and barrier retries just do not work
> correctly together. The issue is this:
>
> - With behind writes, we signal the master_bio complete as soon as all
> non-write-behind writes are complete.
>
> - With barrier retries, you don't know if you'll need to retry until
> you've completed all legs of the write (the last leg to complete might
> throw EOPNOTSUPP).
>
> So in the case where the master_bio has been completed, we still try
> to do a retry for the leg that failed the barrier (but it's really too
> late to retry). In any case, raid1d is touching master_bio (looking at
> bi_size and bio_cloning it) during the retry, which causes a panic if
> master_bio is already being reused by someone else.
>
> I can't think of a good way to do behind writes and barrier retries
> together. Seems we've got to disable behind writes for barriers, or
> we've got to disable barrier retries when doing behind writes...
>
> Any thoughts?
I suspect you are right that barriers and behind writes are deeply
incompatible. I suspect they could be made to work together in some vaguely
sane way, but I suspect it would be a lot of work and not worth the effort.
Disabling behind-writes for all barrier requests would be quite easy, but it
might negate a lot of the value of behind writes
We could simply ignore the barrier flag on writes to behind-write devices,
but that would risk them being even more inconsistent than they currently can
be, so I doubt that is a good direct - though it is a possibility.
I think the best option is to reject barrier writes if there are any
behind-write devices. That would be reasonably safe and reasonably
consistent.
So maybe something like this??
NeilBrown
Index: linux-2.6.32.orig/drivers/md/bitmap.c
===================================================================
--- linux-2.6.32.orig.orig/drivers/md/bitmap.c 2009-12-03 14:51:21.000000000 +1100
+++ linux-2.6.32.orig/drivers/md/bitmap.c 2011-02-02 11:31:51.156585883 +1100
@@ -1676,6 +1676,8 @@ int bitmap_create(mddev_t *mddev)
pages, bmname(bitmap));
mddev->bitmap = bitmap;
+ if (bitmap->max_write_behind)
+ mddev->barriers_work = 0;
mddev->thread->timeout = bitmap->daemon_sleep * HZ;
next prev parent reply other threads:[~2011-02-02 0:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AANLkTimp7eGLu5UEr-wH9MVSGrQWA3PKMakW74_48gk7@mail.gmail.com>
2011-01-20 16:52 ` [BUG 2.6.32] md/raid1: barrier disabling does not work correctly in all cases Paul Clements
2011-01-20 20:25 ` NeilBrown
2011-01-20 20:44 ` Paul Clements
2011-01-26 13:55 ` Paul Clements
2011-02-01 20:45 ` Paul Clements
2011-02-02 0:32 ` NeilBrown [this message]
2011-02-02 1:04 ` Paul Clements
2011-02-24 21:04 ` Paul Clements
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=20110202113215.3e106ccb@notabene.brown \
--to=neilb@suse.de \
--cc=linux-raid@vger.kernel.org \
--cc=paul.clements@us.sios.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).