Skip to contentSkip to conversation

ext4: unlock group before returning on error

PATCH In review Aneesh Kumar K.V 2 participants 3 messages Nov 3, 2008 – Nov 4, 2008 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ext4: unlock group before returning on error

with errors=continue we need to make sure we need
to unlock the group before returning.

---
 fs/ext4/mballoc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/ext4/mballoc.c +1 -0
index d523e42..0643f9c 100644
@@ -4446,6 +4446,7 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
 		else if (block >= (entry->start_blk + entry->count))
 			n = &(*n)->rb_right;
 		else {
+			ext4_unlock_group(sb, group);
 			ext4_error(sb, __func__,
 			    "Double free of blocks %d (%d %d)\n",
 			    block, entry->start_blk, entry->count);
Signature · 1 line
1.6.0.3.514.g2f91b
#1 lore raw

PATCH 2/2 ext4: Convert to host order before using the values.

Use le16_to_cpu to read the s_reserved_gdt_blocks values from super block.

---
 fs/ext4/super.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
fs/ext4/super.c +2 -3
index 87ac84b..5bfc235 100644
@@ -1464,9 +1464,8 @@ static int ext4_fill_flex_info(struct super_block *sb)
 
 	/* We allocate both existing and potentially added groups */
 	flex_group_count = ((sbi->s_groups_count + groups_per_flex - 1) +
-			    ((sbi->s_es->s_reserved_gdt_blocks +1 ) <<
-			      EXT4_DESC_PER_BLOCK_BITS(sb))) /
-			   groups_per_flex;
+			((le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) + 1) <<
+			      EXT4_DESC_PER_BLOCK_BITS(sb))) / groups_per_flex;
 	sbi->s_flex_groups = kzalloc(flex_group_count *
 				     sizeof(struct flex_groups), GFP_KERNEL);
 	if (sbi->s_flex_groups == NULL) {
Signature · 1 line
1.6.0.3.514.g2f91b
maintainer
#2 lore raw

Re: [PATCH -V2 2/2] ext4: Convert to host order before using the values.

Thanks, both of these patches have been added to the ext4 patch queue.

- Ted