ocfs2: unlock bh_state if bg check fails
PATCH 1/1 ocfs2: unlock bh_state if bg check fails
We should unlock bh_stat if bg->bg_free_bits_count > bg->bg_bits
Suggested-by Jan Kara <[email protected]>
Signed-off-by Changwei Ge <[email protected]>
--- fs/ocfs2/suballoc.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ocfs2/suballoc.c +2 -0
@@ -2441,6 +2441,8 @@ static int ocfs2_block_group_clear_bits(handle_t *handle, }le16_add_cpu (&bg->bg_free_bits_count, num_bits);if (le16_to_cpu (bg->bg_free_bits_count) >le16_to_cpu (bg->bg_bits)) { +if (undo_fn) +jbd_unlock_bh_state (group_bh); return ocfs2_error(alloc_inode->i_sb, "Group descriptor # %llu has bit count %u but claims %u are freed. num_bits %d\n", (unsigned long long)le64_to_cpu(bg->bg_blkno), le16_to_cpu(bg->bg_bits),
Signature · 1 line
2.7.4
PATCH 1/1 ocfs2: unlock bh_state if bg check fails
Reviewed-by Gang He <[email protected]>
Thanks
Gang
Quoted 32 lines
Quoted 1 line
Quoted 1 line
We should unlock
bh_statifbg->bg_free_bits_count>bg->bg_bitsSuggested-by Jan Kara <[email protected]>Signed-off-by Changwei Ge <[email protected]>--- fs/ocfs2/suballoc.c | 2 ++ 1 file changed, 2 insertions(+)fs/ocfs2/suballoc.c +2
-0@@ -2441,6 +2441,8 @@ static int ocfs2_block_group_clear_bits(handle_t *handle, }le16_add_cpu (&bg->bg_free_bits_count, num_bits); if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { + if (undo_fn) + jbd_unlock_bh_state(group_bh); return ocfs2_error(alloc_inode->i_sb, "Group descriptor # %llu has bit count %u but claims %u are freed. num_bits %d\n",fs/ocfs2/suballoc.c +0
-0(unsigned long long )le64_to_cpu (bg->bg_blkno), le16_to_cpu(bg->bg_bits),Signature · 7 lines
2.7.4 _______________________________________________ Ocfs2-devel mailing list Ocfs2-devel at oss.oracle.com https://oss.oracle.com/mailman/listinfo/ocfs2-devel
PATCH 1/1 ocfs2: unlock bh_state if bg check fails
In reply to Changwei GeLGTM
Quoted 4 lines · Changwei Ge
We should unlock
bh_statifbg->bg_free_bits_count>bg->bg_bitsSuggested-by Jan Kara <[email protected]>Signed-off-by Changwei Ge <[email protected]>
Reviewed-by Jun Piao <[email protected]>
Quoted 18 lines
--- fs/ocfs2/suballoc.c | 2 ++ 1 file changed, 2 insertions(+)fs/ocfs2/suballoc.c +2
-0@@ -2441,6 +2441,8 @@ static int ocfs2_block_group_clear_bits(handle_t *handle, }le16_add_cpu (&bg->bg_free_bits_count, num_bits);if (le16_to_cpu (bg->bg_free_bits_count) >le16_to_cpu (bg->bg_bits)) { +if (undo_fn) +jbd_unlock_bh_state (group_bh); return ocfs2_error(alloc_inode->i_sb, "Group descriptor # %llu has bit count %u but claims %u are freed. num_bits %d\n", (unsigned long long)le64_to_cpu(bg->bg_blkno), le16_to_cpu(bg->bg_bits),