Re: [PATCH] ext4: fix resize when resizing within single group

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 02, 2012 at 10:05:55AM +0100, Lukas Czerner wrote:
> When resizing file system in the way that the new size of the file
> system is still in the same group (no new groups are added), then we can
> hit a BUG_ON in ext4_alloc_group_tables()
> 
> BUG_ON(flex_gd->count == 0 || group_data == NULL);
> 
> because flex_gd->count is zero. The reason is the missing check for such
> case, so the code always extend the last group fully and then attempt to
> add more groups, but at that time n_blocks_count is actually smaller
> than o_blocks_count.
> 
> It can be easily reproduced like this:
> 
> mkfs.ext4 -b 4096 /dev/sda 30M
> mount /dev/sda /mnt/test
> resize2fs /dev/sda 50M
> 
> Fix this by checking whether the resize happens within the singe group
> and only add that many blocks into the last group to satisfy user
> request. Then o_blocks_count == n_blocks_count and the resize will exit
> successfully without and attempt to add more groups into the fs.
> 
> Also fix mixing together block number and blocks count which might be
> confusing and can easily lead to off-by-one errors (but it is actually
> not the case here since the two occurrence of this mix-up will cancel
> each other).
> 
> Signed-off-by: Lukas Czerner <lczerner@xxxxxxxxxx>
> Reported-by: Milan Broz <mbroz@xxxxxxxxxx>

Thanks, applied.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux