aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2021-03-06 23:08:12 -0500
committerTheodore Ts'o <tytso@mit.edu>2021-03-06 23:08:12 -0500
commit3042900ae8fd8292266d615020d6c0e0cea0ea6e (patch)
tree5f13b3c75ec2c10eb001411929284211d9f239c5
parent67f2b54667e65cf5a478fcea8b85722be9ee6e8d (diff)
downloade2fsprogs-3042900ae8fd8292266d615020d6c0e0cea0ea6e.tar.gz
resize2fs: avoid allocating over the MMP block
When resizing past the point where the reserve inode has reserved space for the block group descriptors to expand, and resize2fs (in an offline resize) needs to move the allocation bitmaps and/or inode table around, it's possible for resize2fs to allocate over the MMP block, which would be bad. Prevent this from happening by reserving the MMP block as a file system metadata block (which it is) in resize2fs's accounting. Addresses-Debian-Bug: #984472 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--resize/resize2fs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index a0d08e5b8..daaa3d491 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -1177,6 +1177,11 @@ static errcode_t mark_table_blocks(ext2_filsys fs,
if (blk)
ext2fs_mark_block_bitmap2(bmap, blk);
}
+ /* Reserve the MMP block */
+ if (ext2fs_has_feature_mmp(fs->super) &&
+ fs->super->s_mmp_block > fs->super->s_first_data_block &&
+ fs->super->s_mmp_block < ext2fs_blocks_count(fs->super))
+ ext2fs_mark_block_bitmap2(bmap, fs->super->s_mmp_block);
return 0;
}