Skip to contentSkip to conversation

ocfs2: unlock bh_state if bg check fails

PATCH Applied Changwei Ge 3 participants 3 messages Jan 25, 2018 OCFS2

lore
Share & tools
lore
#0 lore raw

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

---
 fs/ocfs2/suballoc.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ocfs2/suballoc.c +2 -0
index 71f22c8..6fee797 100644
@@ -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
#1 lore raw

PATCH 1/1 ocfs2: unlock bh_state if bg check fails

Thanks
Gang

Quoted 32 lines
Quoted 1 line
Quoted 1 line

We should unlock bh_stat if bg->bg_free_bits_count > bg->bg_bits

---
 fs/ocfs2/suballoc.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ocfs2/suballoc.c +2 -0
index 71f22c8..6fee797 100644
@@ -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
#2 lore raw

PATCH 1/1 ocfs2: unlock bh_state if bg check fails

In reply to Changwei Ge

LGTM

Quoted 4 lines · Changwei Ge

We should unlock bh_stat if bg->bg_free_bits_count > bg->bg_bits

Quoted 18 lines
---
 fs/ocfs2/suballoc.c | 2 ++
 1 file changed, 2 insertions(+)
fs/ocfs2/suballoc.c +2 -0
index 71f22c8..6fee797 100644
@@ -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),