From 22ba4c1dedd61cef3f4e821a0bcfbceccc571a0f Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 6 Jan 2005 14:05:17 -0500 Subject: [PATCH] Make tune2fs and e2fsck consistent about allowing at most 50% of the blocks in a filesystem to be reserved for allocation by the root user. --- e2fsck/ChangeLog | 3 +++ e2fsck/super.c | 2 +- misc/ChangeLog | 7 +++++++ misc/tune2fs.c | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 25a6780..abcaf0a 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -2,6 +2,9 @@ * super.c (check_resize_inode): Use ext2fs_{read,write}_ind_block so that byte swapping is handled on big-endian systems. + (check_super_block): Allow the number of reserved blocks + to be 50% of the number of blocks available, in order to + be consistent to what is allowed by tune2fs. 2004-12-24 Theodore Ts'o diff --git a/e2fsck/super.c b/e2fsck/super.c index ef799f9..2dff3b3 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -476,7 +476,7 @@ void check_super_block(e2fsck_t ctx) check_super_value(ctx, "inodes_per_group", sb->s_inodes_per_group, MIN_CHECK | MAX_CHECK, inodes_per_block, ipg_max); check_super_value(ctx, "r_blocks_count", sb->s_r_blocks_count, - MAX_CHECK, 0, sb->s_blocks_count / 4); + MAX_CHECK, 0, sb->s_blocks_count / 2); check_super_value(ctx, "reserved_gdt_blocks", sb->s_reserved_gdt_blocks, MAX_CHECK, 0, fs->blocksize/4); diff --git a/misc/ChangeLog b/misc/ChangeLog index e5bb292..df95b3f 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,10 @@ +2005-01-06 Theodore Ts'o + + * tune2fs.c (main): When specifying the number of reservered + blocks that can only be allocated by root, enforce a 50% + limit so that the user can't accidentally make a + superblock which e2fsck will think is insane. + 2005-01-05 Theodore Ts'o * fsck.c (PRS): Apply Fedora's e2fsprogs-1.35-progress.patch from diff --git a/misc/tune2fs.c b/misc/tune2fs.c index c300f27..92eee83 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -829,7 +829,7 @@ int main (int argc, char ** argv) reserved_ratio, sb->s_r_blocks_count); } if (r_flag) { - if (reserved_blocks >= sb->s_blocks_count) { + if (reserved_blocks >= sb->s_blocks_count/2) { com_err (program_name, 0, _("reserved blocks count is too big (%lu)"), reserved_blocks); -- 1.8.3.1