From: Joseph Qi Date: Fri, 24 May 2013 22:55:12 +0000 (-0700) Subject: ocfs2: unlock rw lock if inode lock failed X-Git-Tag: v3.10-rc3~12^2~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=afe1bb73f8ed588ab6268c27c5a447fe0484e48f;p=profile%2Fivi%2Fkernel-x86-ivi.git ocfs2: unlock rw lock if inode lock failed In ocfs2_file_aio_write(), it does ocfs2_rw_lock() first and then ocfs2_inode_lock(). But if ocfs2_inode_lock() failed, it goes to out_sems without unlocking rw lock. This will cause a bug in ocfs2_lock_res_free() when testing res->l_ex_holders, which is increased in __ocfs2_cluster_lock() and decreased in __ocfs2_cluster_unlock(). Signed-off-by: Joseph Qi Cc: Joel Becker Cc: Mark Fasheh Cc: Li Zefan Cc: "Duyongfeng (B)" Acked-by: Sunil Mushran Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 8a7509f..ff54014 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -2288,7 +2288,7 @@ relock: ret = ocfs2_inode_lock(inode, NULL, 1); if (ret < 0) { mlog_errno(ret); - goto out_sems; + goto out; } ocfs2_inode_unlock(inode, 1);