On Fri, Jan 13, 2012 at 10:02:46PM -0700, Andreas Dilger wrote: > On 2012-01-13, at 2:30 PM, Theodore Ts'o wrote: > > This is old code from the very early days that is just > > confusing things, and also has the problem of modifying the block > > group descriptor without obeying the ext4_journal_get_write_access() / > > ext4_handle_dirty_metadata() modification protocols. > > The group descriptor was already modified earlier on when the inode was > being allocated from the group, so the group descriptor block was already > accounted for in the transaction credits after "repeat_in_this_group:" That's true, but we also have to modify the block bitmap block itself; and that's a journal credit which is currently not accounted for. Fortunately we're over conservative enough in how we calculate the number of journal credits necessary that in practice we don't BUG_ON due to running out ouf journal credits. > I'm not wholly against removing this code, but we have to do it with the > clear understanding that we will have inodes in use for which the block > bitmap is showing that the in-use blocks are free. This doesn't seem like > a great situation to me. We have backup block groups descriptors and (in the case of meta_bg, which is needed for 64-bit resize) primary block group descriptors which are also only accounted for by the fields in the block group descriptors. We can't allocate blocks in that block group without initializing the block bitmap, and ext4_init_block_bitmap() will reserve the appropriate fields; furthermore, if the block group checksum is incorrect, it will lock out the block group by marking all blocks as used and setting the number of free inodes and blocks to zero. So it should be a safe thing to do. - 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