mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: Andrew Morton <akpm@osdl.org>
Cc: Mingming Cao <cmm@us.ibm.com>, linux-kernel@vger.kernel.org
Subject: Re: [Patch] ext3_new_inode() failure case fix
Date: Wed, 22 Sep 2004 08:29:25 +0100	[thread overview]
Message-ID: <20040922072925.GH23987@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20040921230124.368e469c.akpm@osdl.org>

On Tue, Sep 21, 2004 at 11:01:24PM -0700, Andrew Morton wrote:
> Mingming Cao <cmm@us.ibm.com> wrote:
> >
> > While I am studying ext3_new_inode() failure code paths, I found the
> > inode->i_nlink is not cleared to 0 in the first failure path. But it is
> > cleared to 0 in the second failure path(fail to allocate disk quota). I
> > think it should be cleared in both cases, because later when
> > generic_drop_inode() is called by iput(), i_nlink is checked to decide
> > whether to call generic_delete_inode(). Currently it is calling
> > generic_forget_inode().
> > 
> > Also the reference to the inode bitmap buffer head should be dropped on
> > the failure path too.
> 
> That reference already is dropped:
> 
> > --- linux-2.6.9-rc1-mm5/fs/ext3/ialloc.c~ext3_new_inode_failure_case_fix	2004-09-22 00:18:18.196012520 -0700
> > +++ linux-2.6.9-rc1-mm5-ming/fs/ext3/ialloc.c	2004-09-22 00:19:20.063607216 -0700
> > @@ -622,7 +622,9 @@ got:
> >  fail:
> >  	ext3_std_error(sb, err);
> >  out:
> > +	inode->i_nlink = 0;
> >  	iput(inode);
> > +	brelse(bitmap_bh);
> >  	ret = ERR_PTR(err);
> >  really_out:
> >  	brelse(bitmap_bh);
> 
>         ^ here
> 
> So I'll drop that part of the patch.

Drop it completely - we do *NOT* want ->delete_inode() to be called until
we had done allocation (and set sane ->i_ino, while we are at it).  And
that's exactly the difference between places that bail to fail2 and places
that bail to out.

      reply	other threads:[~2004-09-22  7:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-07 13:02 [Patch 0/6]: Cleanup and rbtree for ext3 reservations in 2.6.9-rc1-mm4 Stephen Tweedie
2004-09-11  0:34 ` Mingming Cao
2004-09-12  7:59   ` Ram Pai
2004-09-22  1:04 ` [Patch] ext3_new_inode() failure case fix Mingming Cao
2004-09-22  6:01   ` Andrew Morton
2004-09-22  7:29     ` viro [this message]

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=20040922072925.GH23987@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=akpm@osdl.org \
    --cc=cmm@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®