Bug 14601 - Wrong handling of META_BG when getting number of blocks for group descriptors
Summary: Wrong handling of META_BG when getting number of blocks for group descriptors
Status: CLOSED OBSOLETE
Alias: None
Product: File System
Classification: Unclassified
Component: ext4 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: fs_ext4@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-14 11:15 UTC by DamienDGU
Modified: 2012-06-18 12:34 UTC (History)
3 users (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments
ext3/balloc.c and ext4/balloc.c change to count number of descriptors blocks (2.58 KB, patch)
2009-11-14 11:15 UTC, DamienDGU
Details | Diff

Description DamienDGU 2009-11-14 11:15:15 UTC
Created attachment 23778 [details]
ext3/balloc.c and ext4/balloc.c change to count number of descriptors blocks

When computing number of blocks for group descriptors for a given group, the total number of blocks for group descriptors is returned in case META_BG is enabled and group is inside the first groups (such as block of its descriptor is below s_first_meta_bg). I think it should be limited to s_first_meta_bg.
This behaviour is incoherent with e2fsprogs behaviour (see http://marc.info/?l=linux-ext4&m=125794126219545&w=2) and can lead to corruption in case performing e2fsck on a filesystem where an uninitialized block bitmap was initialized by kernel.
I attach a proposed change, but:
- I did not compiled, nor tried it.
- it is for ext3 and ext4.
- I am not sure it is enough: there is some other location where s_gdb_count is used and where perhaps ext4_bg_num_gdb should be used instead as in ext4_setup_system_zone (I do not understand the behaviour here, it seems to not take META_BG flag into account at all) or ex4_iget.
Comment 1 Jan Kara 2009-11-17 21:47:49 UTC
Thanks for the patch. It looks good but please look at Documentation/SubmittingPatches how a patch for kernel should look like (most notably it misses a Signed-off-by, it should be in a unified format and with a changelog). Also please create one patch for ext3 and one patch for ext4 since I will merge the ext3 part and Ted Tso takes care of ext4. Thanks.
Comment 2 Theodore Tso 2009-11-17 22:57:23 UTC
Jan, I have a IMHO better set of patches which I plan to merge for ext4; it ends up simplifying the code, and makes it easier to read.   I'll backport my ext4 fixes to ext3 and send them to you.  It's on my todo list.
Comment 3 Jan Kara 2009-11-18 09:52:46 UTC
OK, I'll wait for your backport then. Thanks.

Note You need to log in before you can comment on or make changes to this bug.