Whamcloud - gitweb
resize2fs: Fix data corruption bug when shrinking the inode table for ext4
authorTheodore Ts'o <tytso@mit.edu>
Sun, 19 Apr 2009 02:32:03 +0000 (22:32 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 19 Apr 2009 02:32:03 +0000 (22:32 -0400)
commitc09043f1abb99c73d681e630ee0a4b142e4abf6b
treec74b6dab6405b74115d93b53dae08381163b05a0
parent1ac84a948dc0cb867fb33b43ab1d67c71d207cc8
resize2fs: Fix data corruption bug when shrinking the inode table for ext4

If we need to shrink the inode table, we need to make sure the inodes
contained in the part of the inode table we are vacating don't get
reused as part of the filesystem shrink operation.  This wasn't a
problem with ext3 filesystems, since the inode table was located in
the block group that was going away, so that location was not eligible
for reallocation.

However with ext4 filesystems with flex_bg enabled, it's possible for
a portion of the inode table in the last flex_bg group to be
deallocated, but in a part of the filesystem which could be used as
data blocks.  So we must mark those blocks as reserved to prevent
their reuse, and adjust the minimum filesystem size calculation to
assure that we don't shrink a filesystem too small for the resize
operation to succeed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
resize/online.c
resize/resize2fs.c
resize/resize2fs.h