Commit 1e6d9153 authored by Tao Ma's avatar Tao Ma Committed by Joel Becker

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: default avatarTao Ma <boyu.mt@taobao.com>
Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
parent cfc069d3
...@@ -1017,8 +1017,11 @@ static int ocfs2_double_lock(struct ocfs2_super *osb, ...@@ -1017,8 +1017,11 @@ static int ocfs2_double_lock(struct ocfs2_super *osb,
* An error return must mean that no cluster locks * An error return must mean that no cluster locks
* were held on function exit. * were held on function exit.
*/ */
if (oi1->ip_blkno != oi2->ip_blkno) if (oi1->ip_blkno != oi2->ip_blkno) {
ocfs2_inode_unlock(inode2, 1); ocfs2_inode_unlock(inode2, 1);
brelse(*bh2);
*bh2 = NULL;
}
if (status != -ENOENT) if (status != -ENOENT)
mlog_errno(status); mlog_errno(status);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment