[Patch] ext3_new_inode() failure case fix

From: Mingming Cao
Date: Tue Sep 21 2004 - 20:05:08 EST


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);

_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/