From: Andrew Morton <akpm@osdl.org>
To: Jan Kara <jack@suse.cz>
Cc: Dave Jones <davej@redhat.com>,
Badari Pulavarty <pbadari@us.ibm.com>,
Eric Sandeen <sandeen@sandeen.net>,
Linux Kernel <linux-kernel@vger.kernel.org>,
esandeen@redhat.com
Subject: Re: 2.6.18 ext3 panic.
Date: Tue, 10 Oct 2006 11:42:53 -0700 [thread overview]
Message-ID: <20061010114253.3f76c428.akpm@osdl.org> (raw)
In-Reply-To: <20061010141145.GM23622@atrey.karlin.mff.cuni.cz>
On Tue, 10 Oct 2006 16:11:45 +0200
Jan Kara <jack@suse.cz> wrote:
> > On Mon, Oct 09, 2006 at 02:59:25PM -0700, Badari Pulavarty wrote:
> >
> > > journal_dirty_data() would do submit_bh() ONLY if its part of the older
> > > transaction.
> > >
> > > I need to take a closer look to understand the race.
> > >
> > > BTW, is this 1k or 2k filesystem ?
> >
> > (18:41:11:davej@gelk:~)$ sudo tune2fs -l /dev/md0 | grep size
> > Block size: 1024
> > Fragment size: 1024
> > Inode size: 128
> > (18:41:16:davej@gelk:~)$
> >
> > > How easy is to reproduce the problem ?
> >
> > I can reproduce it within a few hours of stressing, but only
> > on that one box. I've not figured out exactly what's so
> > special about it yet (though the 1k block thing may be it).
> > I had been thinking it was a raid0 only thing, as none of
> > my other boxes have that.
> >
> > I'm not entirely sure how it got set up that way either.
> > The Fedora installer being too smart for its own good perhaps.
> I think it's really the 1KB block size that makes it happen.
> I've looked at journal_dirty_data() code and I think the following can
> happen:
> sync() eventually ends up in journal_dirty_data(bh) as Eric writes.
> There is finds dirty buffer attached to the comitting transaction. So it drops
> all locks and calls sync_dirty_buffer(bh).
> Now in other process, file is truncated so that 'bh' gets just after EOF.
> As we have 1kb buffers, it can happen that bh is in the partially
> truncated page. Buffer is marked unmapped and clean. But in a moment the page
> is marked dirty and msync() is called. That eventually calls
> set_page_dirty() and all buffers in the page are marked dirty.
> The first process now wakes up, locks the buffer, clears the dirty bit
> and does submit_bh() - Oops.
>
> This is essentially the same problem Badari found but in a different
> place. There are two places that are arguably wrong...
> 1) We mark buffer dirty after EOF. But actually that may be needed -
> or what is the expected behaviour when we write into mmapped file after
> EOF, then extend the file and do msync()?
yup.
> 2) We submit a buffer after EOF for IO. This should be clearly avoided
> but getting the needed info from bh is really ugly...
Things like __block_write_full_page() avoid this by checking the block's
offset against i_size. (Not racy against truncate-down because the page is
locked, not racy against truncate-up because the bh is zero and
up-to-date).
But for jbd writeout we don't hold the page lock, so checking against
bh->b_page->host->i_size is a bit racy.
hm. But we do lock the buffers in journal_invalidatepage(), so checking
i_size after locking the buffer in the writeout path might get us there.
next prev parent reply other threads:[~2006-10-10 18:43 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-02 19:47 Dave Jones
2006-10-03 5:22 ` Dave Jones
2006-10-03 5:43 ` Eric Sandeen
2006-10-03 6:19 ` Andrew Morton
2006-10-03 6:40 ` Dave Jones
2006-10-03 16:45 ` Dave Jones
2006-10-09 19:46 ` Eric Sandeen
2006-10-09 19:59 ` Eric Sandeen
2006-10-09 21:59 ` Badari Pulavarty
2006-10-09 22:50 ` Dave Jones
2006-10-10 14:11 ` Jan Kara
2006-10-10 18:42 ` Andrew Morton [this message]
2006-10-10 22:03 ` Eric Sandeen
2006-10-10 22:25 ` Badari Pulavarty
2006-10-11 1:43 ` Eric Sandeen
2006-10-11 10:33 ` Jan Kara
2006-10-11 13:44 ` Eric Sandeen
2006-10-11 14:22 ` Jan Kara
2006-10-11 17:54 ` Badari Pulavarty
2006-10-12 2:36 ` Eric Sandeen
2006-10-12 4:34 ` John Wendel
2006-10-12 6:57 ` Jan-Benedict Glaw
2006-10-12 12:28 ` Jan Kara
2006-10-12 13:20 ` Eric Sandeen
2006-10-12 16:40 ` Andrew Morton
2006-10-12 16:44 ` Eric Sandeen
2006-10-12 20:07 ` Eric Sandeen
2006-10-12 21:55 ` Badari Pulavarty
2006-10-12 21:57 ` Eric Sandeen
2006-10-12 22:34 ` Badari Pulavarty
2006-10-13 7:56 ` Jan Kara
2006-10-13 16:08 ` Eric Sandeen
2006-10-16 16:54 ` Jan Kara
2006-10-16 16:56 ` Eric Sandeen
2006-10-09 22:40 ` Jan-Benedict Glaw
2006-10-10 13:16 ` Jan Kara
2006-10-10 16:39 ` Jan-Benedict Glaw
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=20061010114253.3f76c428.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=davej@redhat.com \
--cc=esandeen@redhat.com \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=pbadari@us.ibm.com \
--cc=sandeen@sandeen.net \
/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
all inboxes | Powered by JetHome®