From: Dave Chinner <david@fromorbit.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: BUG in ext4 with 2.6.37-rc1
Date: Thu, 4 Nov 2010 09:56:46 +1100 [thread overview]
Message-ID: <20101103225646.GC9169@dastard> (raw)
In-Reply-To: <4CD1A67D.5060909@redhat.com>
On Wed, Nov 03, 2010 at 02:14:21PM -0400, Eric Sandeen wrote:
> On 11/2/10 4:20 PM, Nick Bowler wrote:
> > The following BUG occurred today while compiling gcc, with 2.6.37-rc1+.
> > More precisely, commit 7fe19da4ca38 ("preempt: fix kernel build with
> > !CONFIG_BKL") with http://permalink.gmane.org/gmane.linux.nfs/36521
> > applied on top. It basically took out the whole system.
> >
> > ------------[ cut here ]------------
> > kernel BUG at /scratch_space/linux-2.6/fs/ext4/page-io.c:146!
>
> 138 ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags)
> 139 {
> 140 ext4_io_end_t *io = NULL;
> 141
> 142 io = kmem_cache_alloc(io_end_cachep, flags);
> 143 if (io) {
> 144 memset(io, 0, sizeof(*io));
> 145 io->inode = igrab(inode);
> 146 BUG_ON(!io->inode);
>
> igrab can fail if it's being torn down:
>
> /*
> * Handle the case where s_op->clear_inode is not been
> * called yet, and somebody is calling igrab
> * while the inode is getting freed.
> */
> inode = NULL;
>
> and boom.
Oh, nasty.
FWIW, the XFS code this was copied from doesn't have this problem
because the struct inode is not tagged for reclaim in
->destroy_inode until all writeback IO is completed. We keep a
separate active ioend reference count in the struct xfs_inode, and
the inode is never freed while there are still active IO references
(see the xfs_ioend_wait() call in xfs_fs_destroy_inode).
Hence the XFS ->writepage path does not need to take inode
references to handle the possibility of an inode being freed from
under it because the inode lifecycle model guarantees it
cannot occur. Perhaps ext4 needs to copy more from XFS.... ;)
BTW, io_end_cachep() probably should use a mempool (like the
equivalent XFS ioend slab cache), otherwise ext4 won't be able to
make writeback progress in OOM conditions and will avoid needing to
handle ENOMEM errors in ->writepage.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2010-11-03 22:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-02 20:20 BUG in ext4 with 2.6.37-rc1 Nick Bowler
2010-11-03 18:14 ` [PATCH -BUGFIX] " Ted Ts'o
2010-11-03 18:22 ` Nick Bowler
2010-11-03 20:53 ` Nick Bowler
2010-11-07 21:21 ` Ted Ts'o
2010-11-07 22:53 ` Tony Vroon
2010-11-08 1:19 ` Dave Chinner
2010-11-08 5:00 ` [PATCH -v3] ext4: handle writeback of inodes which are being freed Ted Ts'o
2010-11-08 6:05 ` [PATCH -v4] " Ted Ts'o
2010-11-08 16:28 ` Nick Bowler
2010-11-08 16:54 ` Ted Ts'o
2010-11-08 6:43 ` [PATCH -v3] " Dave Chinner
2010-11-03 18:14 ` BUG in ext4 with 2.6.37-rc1 Eric Sandeen
2010-11-03 22:56 ` Dave Chinner [this message]
2010-11-05 23:09 ` Tony Vroon
2010-11-06 0:33 ` Theodore Tso
2010-11-06 0:39 ` Tony Vroon
2010-11-06 12:50 ` Ted Ts'o
2010-11-06 1:06 ` Tony Vroon
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=20101103225646.GC9169@dastard \
--to=david@fromorbit.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sandeen@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 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).