aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/namei.c
diff options
context:
space:
mode:
authorTao Ma <boyu.mt@taobao.com>2010-12-20 03:21:11 -0500
committerJoel Becker <joel.becker@oracle.com>2010-12-22 21:34:42 -0500
commit1e6d9153df27923649976554d034a69ac7b28f95 (patch)
treedfb165957114d9cd6afd1ddbc316ff65d001bed1 /fs/ocfs2/namei.c
parentcfc069d3fa24d7c6357e3b731e97f94db495bf0c (diff)
ocfs2: Release buffer_head in case of error in ocfs2_double_lock.
In ocfs2_double_lock, when ocfs2_inode_lock for inode1 fails, we just unlock inode2 and return without releasing buffer we get from inode_lock(inode2). The good thing is that it is freed by the only caller ocfs2_rename when it exits. But I don't think this is a right way for error handling. We should free the buffer_head we get in ocfs2_double_lock before exit so that the caller doesn't need to take care of it. Signed-off-by: Tao Ma <boyu.mt@taobao.com> Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/namei.c')
-rw-r--r--fs/ocfs2/namei.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index ff5744e1e36f..ca35f81a13bb 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -1017,8 +1017,11 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
1017 * An error return must mean that no cluster locks 1017 * An error return must mean that no cluster locks
1018 * were held on function exit. 1018 * were held on function exit.
1019 */ 1019 */
1020 if (oi1->ip_blkno != oi2->ip_blkno) 1020 if (oi1->ip_blkno != oi2->ip_blkno) {
1021 ocfs2_inode_unlock(inode2, 1); 1021 ocfs2_inode_unlock(inode2, 1);
1022 brelse(*bh2);
1023 *bh2 = NULL;
1024 }
1022 1025
1023 if (status != -ENOENT) 1026 if (status != -ENOENT)
1024 mlog_errno(status); 1027 mlog_errno(status);