aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2011-08-02 08:17:27 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2011-10-21 07:39:23 -0400
commit40ac218f52aa5cac7dc8082f28b61c8b2b29373c (patch)
tree34e86173a2554b738f0141a1c38ffc3191d2f228 /fs/gfs2/inode.c
parent1d4ec642d9f00d4c531b1a4ae0613091ec1f8e9b (diff)
GFS2: Fix inode allocation error path
If we have got far enough through the inode allocation code path that an inode has already been allocated, then we must call iput to dispose of it, if an error occurs during a later part of the process. This will always be the final iput since there will be no other references to the inode. Unlike when the inode has been unlinked, its block state will be GFS2_BLKST_INODE rather than GFS2_BLKST_UNLINKED so we need to skip the test in ->evict_inode() for this one case in order to ensure that it will be deallocated correctly. This patch adds a new flag in order to ensure that this will happen correctly. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 900cf986aadc..044efe273b97 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -736,10 +736,12 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
736 736
737fail_gunlock2: 737fail_gunlock2:
738 gfs2_glock_dq_uninit(ghs + 1); 738 gfs2_glock_dq_uninit(ghs + 1);
739 if (inode && !IS_ERR(inode))
740 iput(inode);
741fail_gunlock: 739fail_gunlock:
742 gfs2_glock_dq_uninit(ghs); 740 gfs2_glock_dq_uninit(ghs);
741 if (inode && !IS_ERR(inode)) {
742 set_bit(GIF_ALLOC_FAILED, &GFS2_I(inode)->i_flags);
743 iput(inode);
744 }
743fail: 745fail:
744 if (bh) 746 if (bh)
745 brelse(bh); 747 brelse(bh);