cannot metex_unlock without mutex_lock in ocfs2_remove_btree_range
PATCH 1/2 cannot metex_unlock without mutex_lock in ocfs2_remove_btree_range
In ocfs2_remove_btree_range, when calling ocfs2_lock_refcount_tree and ocfs2_prepare_refcount_change_for_del failed, it goes to out and then tries to call mutex_unlock without mutex_lock before.
--- fs/ocfs2/alloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ocfs2/alloc.c +3 -3
@@ -5655,7 +5655,7 @@ int ocfs2_remove_btree_range(struct inode *inode, &ref_tree, NULL);if (ret) {mlog_errno (ret); - goto out; + goto bail; } ret = ocfs2_prepare_refcount_change_for_del(inode,
@@ -5666,7 +5666,7 @@ int ocfs2_remove_btree_range(struct inode *inode, &extra_blocks);if (ret <0 ) {mlog_errno (ret); - goto out; + goto bail; } }
@@ -5734,7 +5734,7 @@ out_commit:ocfs2_commit_trans (osb, handle); out:mutex_unlock (&tl_inode->i_mutex); - +bail:if (meta_ac)ocfs2_free_alloc_context (meta_ac);
Signature · 1 line
1.7.9.7
PATCH 1/2 cannot metex_unlock without mutex_lock in ocfs2_remove_btree_range
Quoted 3 lines · Joseph Qi
In
ocfs2_remove_btree_range, when callingocfs2_lock_refcount_treeandocfs2_prepare_refcount_change_for_delfailed, it goes to out and then tries to callmutex_unlockwithoutmutex_lockbefore.
It's better to merge both into one patch because it's apparent that ocfs2_reserve_blocks_for_rec_trunc() need to fix in the same way for the same reason.
Thanks,
-Jeff
Quoted 37 lines
Signed-off-by Joseph Qi <[email protected]>--- fs/ocfs2/alloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)fs/ocfs2/alloc.c +3
-3@@ -5655,7 +5655,7 @@ int ocfs2_remove_btree_range(struct inode *inode, &ref_tree, NULL);if (ret) {mlog_errno (ret); - goto out; + goto bail; } ret = ocfs2_prepare_refcount_change_for_del(inode,@@ -5666,7 +5666,7 @@ int ocfs2_remove_btree_range(struct inode *inode, &extra_blocks);if (ret <0 ) {mlog_errno (ret); - goto out; + goto bail; } }@@ -5734,7 +5734,7 @@ out_commit:ocfs2_commit_trans (osb, handle); out:mutex_unlock (&tl_inode->i_mutex); - +bail:if (meta_ac)ocfs2_free_alloc_context (meta_ac);
PATCH 1/2 cannot metex_unlock without mutex_lock in ocfs2_remove_btree_range
Quoted 41 lines · Jeff Liu
Quoted 3 lines · Joseph Qi
In
ocfs2_remove_btree_range, when callingocfs2_lock_refcount_treeandocfs2_prepare_refcount_change_for_delfailed, it goes to out and then tries to callmutex_unlockwithoutmutex_lockbefore.It's better to merge both into one patch because it's apparent that
ocfs2_reserve_blocks_for_rec_trunc()need to fix in the same way for the same reason.Thanks,
-JeffQuoted 28 lines
Signed-off-by Joseph Qi <[email protected]>--- fs/ocfs2/alloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)fs/ocfs2/alloc.c +2
-2@@ -5655,7 +5655,7 @@ int ocfs2_remove_btree_range(struct inode *inode, &ref_tree, NULL);if (ret) {mlog_errno (ret); - goto out; + goto bail; } ret = ocfs2_prepare_refcount_change_for_del(inode,@@ -5666,7 +5666,7 @@ int ocfs2_remove_btree_range(struct inode *inode, &extra_blocks);if (ret <0 ) {mlog_errno (ret); - goto out; + goto bail; } }
Quoted 13 lines
fs/ocfs2/alloc.c out_commit: · line 5740
Quoted 9 lines
fs/ocfs2/alloc.c +1
-1@@ -5734,7 +5734,7 @@ out_commit:ocfs2_commit_trans (osb, handle); out:mutex_unlock (&tl_inode->i_mutex); - +bail:if (meta_ac)ocfs2_free_alloc_context (meta_ac);
Thanks for your review. I will merge them and then resend the patch.