aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjiangyiwen <jiangyiwen@huawei.com>2014-04-03 17:47:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-03 19:20:57 -0400
commit7dc3e83901b342ea7fe36262329c3784f2937361 (patch)
treee23d55a0c0bd98a0fce8e197e3e388bcdbaff655
parentda8ded405de74de4b189d1128f4c102d06328c29 (diff)
ocfs2: iput inode alloc when failed locally
In ocfs2_info_handle_freeinode() and ocfs2_test_inode_bit() func, after calls ocfs2_get_system_file_inode() to get inode ref, if calls ocfs2_info_scan_inode_alloc() or ocfs2_inode_lock() failed, we should iput inode alloc to avoid leaking the inode. Signed-off-by: jiangyiwen <jiangyiwen@huawei.com> Reviewed-by: Joseph Qi <joseph.qi@huawei.com> Cc: Mark Fasheh <mfasheh@suse.de> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/ocfs2/ioctl.c5
-rw-r--r--fs/ocfs2/suballoc.c1
2 files changed, 4 insertions, 2 deletions
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
index 8ca3c29accbf..490229f43731 100644
--- a/fs/ocfs2/ioctl.c
+++ b/fs/ocfs2/ioctl.c
@@ -413,11 +413,12 @@ int ocfs2_info_handle_freeinode(struct inode *inode,
413 } 413 }
414 414
415 status = ocfs2_info_scan_inode_alloc(osb, inode_alloc, blkno, oifi, i); 415 status = ocfs2_info_scan_inode_alloc(osb, inode_alloc, blkno, oifi, i);
416 if (status < 0)
417 goto bail;
418 416
419 iput(inode_alloc); 417 iput(inode_alloc);
420 inode_alloc = NULL; 418 inode_alloc = NULL;
419
420 if (status < 0)
421 goto bail;
421 } 422 }
422 423
423 o2info_set_request_filled(&oifi->ifi_req); 424 o2info_set_request_filled(&oifi->ifi_req);
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index 94fb1f3d9e62..0cb889a17ae1 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -2894,6 +2894,7 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res)
2894 status = ocfs2_inode_lock(inode_alloc_inode, &alloc_bh, 0); 2894 status = ocfs2_inode_lock(inode_alloc_inode, &alloc_bh, 0);
2895 if (status < 0) { 2895 if (status < 0) {
2896 mutex_unlock(&inode_alloc_inode->i_mutex); 2896 mutex_unlock(&inode_alloc_inode->i_mutex);
2897 iput(inode_alloc_inode);
2897 mlog(ML_ERROR, "lock on alloc inode on slot %u failed %d\n", 2898 mlog(ML_ERROR, "lock on alloc inode on slot %u failed %d\n",
2898 (u32)suballoc_slot, status); 2899 (u32)suballoc_slot, status);
2899 goto bail; 2900 goto bail;