public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: return inode to fs when btrfs_new_inode fails
@ 2009-02-25  4:10 Shen Feng
  0 siblings, 0 replies; only message in thread
From: Shen Feng @ 2009-02-25  4:10 UTC (permalink / raw)
  To: linux-btrfs


btrfs_new_inode doesn't call iput to return inode to fs
when it fails.

Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
---
 fs/btrfs/inode.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3cee77a..2cae014 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3443,8 +3443,10 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
 
 	if (dir) {
 		ret = btrfs_set_inode_index(dir, index);
-		if (ret)
+		if (ret) {
+			iput(inode);
 			return ERR_PTR(ret);
+		}
 	}
 	/*
 	 * index_cnt is ignored for everything but a dir,
@@ -3525,6 +3527,7 @@ fail:
 	if (dir)
 		BTRFS_I(dir)->index_cnt--;
 	btrfs_free_path(path);
+	iput(inode);
 	return ERR_PTR(ret);
 }
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-25  4:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-25  4:10 [PATCH] btrfs: return inode to fs when btrfs_new_inode fails Shen Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox