|
|
e427d2 |
From a7a6126b94b9b6b0f88b5a5cc90d069974c89901 Mon Sep 17 00:00:00 2001
|
|
|
e427d2 |
From: Theodore Ts'o <tytso@mit.edu>
|
|
|
e427d2 |
Date: Sat, 6 Mar 2021 23:08:12 -0500
|
|
|
e427d2 |
Subject: [PATCH 24/46] resize2fs: avoid allocating over the MMP block
|
|
|
e427d2 |
Content-Type: text/plain
|
|
|
e427d2 |
|
|
|
e427d2 |
When resizing past the point where the reserve inode has reserved
|
|
|
e427d2 |
space for the block group descriptors to expand, and resize2fs (in an
|
|
|
e427d2 |
offline resize) needs to move the allocation bitmaps and/or inode
|
|
|
e427d2 |
table around, it's possible for resize2fs to allocate over the MMP
|
|
|
e427d2 |
block, which would be bad.
|
|
|
e427d2 |
|
|
|
e427d2 |
Prevent this from happening by reserving the MMP block as a file
|
|
|
e427d2 |
system metadata block (which it is) in resize2fs's accounting.
|
|
|
e427d2 |
|
|
|
e427d2 |
Addresses-Debian-Bug: #984472
|
|
|
e427d2 |
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
|
|
e427d2 |
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
|
|
|
e427d2 |
---
|
|
|
e427d2 |
resize/resize2fs.c | 5 +++++
|
|
|
e427d2 |
1 file changed, 5 insertions(+)
|
|
|
e427d2 |
|
|
|
e427d2 |
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
|
|
|
e427d2 |
index 26050fec..e8401e79 100644
|
|
|
e427d2 |
--- a/resize/resize2fs.c
|
|
|
e427d2 |
+++ b/resize/resize2fs.c
|
|
|
e427d2 |
@@ -1176,6 +1176,11 @@ static errcode_t mark_table_blocks(ext2_filsys fs,
|
|
|
e427d2 |
if (blk)
|
|
|
e427d2 |
ext2fs_mark_block_bitmap2(bmap, blk);
|
|
|
e427d2 |
}
|
|
|
e427d2 |
+ /* Reserve the MMP block */
|
|
|
e427d2 |
+ if (ext2fs_has_feature_mmp(fs->super) &&
|
|
|
e427d2 |
+ fs->super->s_mmp_block > fs->super->s_first_data_block &&
|
|
|
e427d2 |
+ fs->super->s_mmp_block < ext2fs_blocks_count(fs->super))
|
|
|
e427d2 |
+ ext2fs_mark_block_bitmap2(bmap, fs->super->s_mmp_block);
|
|
|
e427d2 |
return 0;
|
|
|
e427d2 |
}
|
|
|
e427d2 |
|
|
|
e427d2 |
--
|
|
|
e427d2 |
2.35.1
|
|
|
e427d2 |
|