public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Neil Brown <neilb@cse.unsw.edu.au>, sct@redhat.com, akpm@osdl.org
Cc: vherva@viasys.com, linux-kernel@vger.kernel.org,
	hifumi.hisashi@lab.ntt.co.jp
Subject: Re: Linux 2.4.30-rc3 md/ext3 problems (ext3 gurus : please check)
Date: Wed, 30 Mar 2005 08:59:46 -0300	[thread overview]
Message-ID: <20050330115946.GA7331@logos.cnet> (raw)
In-Reply-To: <16970.9679.874919.876412@cse.unsw.edu.au>

On Wed, Mar 30, 2005 at 02:06:39PM +1000, Neil Brown wrote:
> On Tuesday March 29, marcelo.tosatti@cyclades.com wrote:
> > 
> > Attached is the backout patch, for convenience.
> 
> Thanks.  I had another look, and think I may be able to see the
> problem.  If I'm right, it is a problem with this patch.
> 
> > diff -Nru a/fs/jbd/commit.c b/fs/jbd/commit.c
> > --- a/fs/jbd/commit.c	2005-03-29 18:50:55 -03:00
> > +++ b/fs/jbd/commit.c	2005-03-29 18:50:55 -03:00
> > @@ -92,7 +92,7 @@
> >  	struct buffer_head *wbuf[64];
> >  	int bufs;
> >  	int flags;
> > -	int err = 0;
> > +	int err;
> >  	unsigned long blocknr;
> >  	char *tagp = NULL;
> >  	journal_header_t *header;
> > @@ -299,8 +299,6 @@
> >  			spin_unlock(&journal_datalist_lock);
> >  			unlock_journal(journal);
> >  			wait_on_buffer(bh);
> > -			if (unlikely(!buffer_uptodate(bh)))
> > -				err = -EIO;
> >  			/* the journal_head may have been removed now */
> >  			lock_journal(journal);
> >  			goto write_out_data;
> 
> 
> I think the "!buffer_update(bh)" test is not safe at this point as,
> after the wait_on_buffer which could cause a schedule, the bh may
> no longer exist, or be for the same block.  There doesn't seem to be
> any locking or refcounting that would keep it valid.
> 
> Note the comment "the journal_head may have been removed now".
> If the journal_head is gone, the associated buffer_head is likely gone
> as well. 

Seems to be possible, yes.

> I'm not certain that this is right, but it seems possible and would
> explain the symptoms.  Maybe Stephen or Andrew could comments?

Andrew, Stephen?

> > --- a/mm/filemap.c	2005-03-29 18:50:55 -03:00
> > +++ b/mm/filemap.c	2005-03-29 18:50:55 -03:00
> > @@ -3261,12 +3261,7 @@
> >  			status = generic_osync_inode(inode, OSYNC_METADATA|OSYNC_DATA);
> >  	}
> >  	
> > -	/*
> > -	 * generic_osync_inode always returns 0 or negative value.
> > -	 * So 'status < written' is always true, and written should
> > -	 * be returned if status >= 0.
> > -	 */
> > -	err = (status < 0) ? status : written;
> > +	err = written ? written : status;
> >  out:
> >  
> >  	return err;
> 
> As an aside, this looks extremely dubious to me.
> 
> There is a loop earlier in this routine (do_generic_file_write) that
> passes a piece-at-a-time of the write request to prepare_write /
> commit_write.
> Successes are counted in 'written'.  A failure causes the loop to
> abort with a status in 'status'.
> 
> If some of the write succeeded and some failed, then I believe the
> correct behaviour is to return the number of bytes that succeeded.
> However this change to the return status (remember the above patch is
> a reversal) causes any failure to over-ride any success. This, I
> think, is wrong.

Yeap, that part also looks wrong.

  reply	other threads:[~2005-03-30 17:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-26 16:28 Linux 2.4.30-rc3 Marcelo Tosatti
2005-03-28  7:34 ` Ville Herva
2005-03-28 16:55   ` Linux 2.4.30-rc3 md/ext3 problems Ville Herva
2005-03-28 17:25     ` Willy Tarreau
2005-03-28 19:29       ` Ville Herva
2005-03-29  0:10     ` Neil Brown
2005-03-29 21:52       ` Marcelo Tosatti
2005-03-30  4:06         ` Linux 2.4.30-rc3 md/ext3 problems (ext3 gurus : please check) Neil Brown
2005-03-30 11:59           ` Marcelo Tosatti [this message]
2005-04-05 22:40             ` Stephen C. Tweedie
     [not found]               ` <1112740856.4148.145.camel@sisko.sctweedie.blueyonder.co.uk >
2005-04-06 10:01                 ` Hifumi Hisashi
2005-04-06 14:20                   ` Stephen C. Tweedie
2005-04-07  3:00                     ` Hifumi Hisashi
2005-04-06 20:10                   ` Stephen C. Tweedie
2005-04-07 15:51                     ` Stephen C. Tweedie
2005-04-11 12:55                       ` Stephen C. Tweedie
2005-04-11 20:46                         ` Andrew Morton
2005-04-11 22:24                           ` Stephen C. Tweedie
2005-04-13 14:34                   ` Stephen C. Tweedie
2005-04-27 22:22                     ` Stephen C. Tweedie
2005-04-28  8:54                       ` Hifumi Hisashi
2005-04-28 11:15                         ` Stephen C. Tweedie

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=20050330115946.GA7331@logos.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=akpm@osdl.org \
    --cc=hifumi.hisashi@lab.ntt.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@cse.unsw.edu.au \
    --cc=sct@redhat.com \
    --cc=vherva@viasys.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