mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mingming Cao <cmm@us.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [Patch] ext3_new_inode() failure case fix
Date: 21 Sep 2004 18:04:00 -0700	[thread overview]
Message-ID: <1095815041.1637.32926.camel@w-ming2.beaverton.ibm.com> (raw)
In-Reply-To: <200409071302.i87D2Dus030892@sisko.scot.redhat.com>

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.

Mingming

---

 linux-2.6.9-rc1-mm5-ming/fs/ext3/ialloc.c |    2 ++
 1 files changed, 2 insertions(+)

diff -puN fs/ext3/ialloc.c~ext3_new_inode_failure_case_fix fs/ext3/ialloc.c
--- 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);

_


  parent reply	other threads:[~2004-09-22  1:03 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 ` Mingming Cao [this message]
2004-09-22  6:01   ` [Patch] ext3_new_inode() failure case fix Andrew Morton
2004-09-22  7:29     ` viro

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=1095815041.1637.32926.camel@w-ming2.beaverton.ibm.com \
    --to=cmm@us.ibm.com \
    --cc=akpm@osdl.org \
    --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®