Re: [PATCH] e2fsprogs: New bitmap and inode table allocation for FLEX_BG v2

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

 



On Mon, 24 Mar 2008 09:46:50 -0400
Theodore Tso <tytso@xxxxxxx> wrote:
> This turns out to be a kludge whose short comings show other problems.
> The real problem is that most of the libext2fs isn't BLOCK_UNINIT
> aware.  So for example, if debugfs is used to write a file into the
> filesystem, and the block group doesn't have an initialized bitmap,
> the Wrong Thing will happen.  More to the point, if you use mke2fs to
> a 1k blocksize filesystem, and the journal is bigger than 16 megs, (or
> with a 4k blocksize filesystem, if the journal is bigger than 512
> megs), you could easily end up allocating the journal into a block
> group with BG_BLOCK_UNINIT.  Oops.
> 
> This wasn't that much of a big deal since up until now lazy_bg was
> only used for debugging really big filesystems, and not much else.  It
> was a quick hack for debugging purposes only.  But given that
> uninititalized blockgroups are intended for more general use, we have
> to make sure all of these corner cases are handled correctly.
> 
> Just looking at it quickly, it seems like the right thing to do is
> split setup_lazy_bg() into two parts.  The first part sets
> EXT2_BG_BLOCK_UNINIT for all block groups, and then we modify the
> block allocation functions in lib/ext2fs to clear the BLOCK_UNINIT
> flag --- and then later on, we update the bg_free_blocks_count and
> s_free_blocks_count for the lazy_bg case.  

It seems that libext2fs is BLOCK_UNINIT aware since the only time we
would need to update the BLOCK_UNINIT flag is if we update the group
descriptors bg_free_blocks_count.  In ext2fs_block_alloc_stats(), the
EXT2_BG_BLOCK_UNINIT flag is unset when this happens.  Having said
that, I think there is a bug in this code if we do not use GDT_CSUM
since setup_lazy_bg() would set bg_free_block_count to zero and this
routine does nothing to set the right number of free blocks.  If
GDT_CSUM is not used, s_free_blocks_count would also need to be updated
as well.

Other than fixing ext2fs_block_alloc_stats(), I don't see anywhere else
in libext2fs where we would need to add awareness to unset the 
BLOCK_UNINIT flag.

-JRS
--
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