LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Mingming Cao <cmm@us.ibm.com>
To: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Cc: Neil Brown <neilb@suse.de>,
	sct@redhat.com, akpm@linux-foundation.org, adilger@clusterfs.com,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ext4 can fail badly when device stops accepting BIO_RW_BARRIER requests.
Date: Thu, 07 Feb 2008 16:22:37 -0800	[thread overview]
Message-ID: <1202430157.3840.14.camel@localhost.localdomain> (raw)
In-Reply-To: <1202358321.6497.5.camel@norville.austin.ibm.com>

On Wed, 2008-02-06 at 22:25 -0600, Dave Kleikamp wrote:
> Duplicating Neil Brown's jbd patch for jbd2.  I guess this can go
> through the ext4 queue rather than straight into -mm.
> 
Checked-in.

Thanks Shaggy and Neil.

Mingming

> Neil's text:
> 
> Some devices - notably dm and md - can change their behaviour in
> response to BIO_RW_BARRIER requests.  They might start out accepting
> such requests but on reconfiguration, they find out that they cannot
> any more.
> 
> ext3 (and other filesystems) deal with this by always testing if
> BIO_RW_BARRIER requests fail with EOPNOTSUPP, and retrying the write
> requests without the barrier (probably after waiting for any pending
> writes to complete).
> 
> However there is a bug in the handling for this for ext3.
> 
> When ext3 (jbd actually) decides to submit a BIO_RW_BARRIER request,
> it sets the buffer_ordered flag on the buffer head.
> If the request completes successfully, the flag STAYS SET.
> 
> Other code might then write the same buffer_head after the device has
> been reconfigured to not accept barriers.  This write will then fail,
> but the "other code" is not ready to handle EOPNOTSUPP errors and the
> error will be treated as fatal.
> 
> This can be seen without having to reconfigure a device at exactly the
> wrong time by putting:
> 
>                 if (buffer_ordered(bh))
>                         printk("OH DEAR, and ordered buffer\n");
> 
> 
> in the while loop in "commit phase 5" of journal_commit_transaction.
> 
> If it ever prints the "OH DEAR ..." message (as it does sometimes for
> me), then that request could (in different circumstances) have failed
> with EOPNOTSUPP, but that isn't tested for.
> 
> My proposed fix is to clear the buffer_ordered flag after it has been
> used, as in the following patch.
> 
> Thanks,
> NeilBrown
> 
> Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
> 
> diff -Nurp linux-2.6.24-mm1/fs/jbd2/commit.c linux/fs/jbd2/commit.c
> --- linux-2.6.24-mm1/fs/jbd2/commit.c	2008-02-04 09:08:44.000000000 -0600
> +++ linux/fs/jbd2/commit.c	2008-02-06 22:11:14.000000000 -0600
> @@ -148,6 +148,8 @@ static int journal_submit_commit_record(
>  		barrier_done = 1;
>  	}
>  	ret = submit_bh(WRITE, bh);
> +	if (barrier_done)
> +		clear_buffer_ordered(bh);
> 
>  	/* is it possible for another commit to fail at roughly
>  	 * the same time as this one?  If so, we don't want to
> @@ -166,7 +168,6 @@ static int journal_submit_commit_record(
>  		spin_unlock(&journal->j_state_lock);
> 
>  		/* And try again, without the barrier */
> -		clear_buffer_ordered(bh);
>  		set_buffer_uptodate(bh);
>  		set_buffer_dirty(bh);
>  		ret = submit_bh(WRITE, bh);
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2008-02-08  0:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-07  1:32 [PATCH] ext3 " Neil Brown
2008-02-07  4:25 ` [PATCH] ext4 " Dave Kleikamp
2008-02-08  0:22   ` Mingming Cao [this message]
2008-02-07 10:58 ` [PATCH] ext3 " Jan Kara

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=1202430157.3840.14.camel@localhost.localdomain \
    --to=cmm@us.ibm.com \
    --cc=adilger@clusterfs.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=sct@redhat.com \
    --cc=shaggy@linux.vnet.ibm.com \
    --subject='Re: [PATCH] ext4 can fail badly when device stops accepting BIO_RW_BARRIER requests.' \
    /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

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).