Whamcloud - gitweb
Make tune2fs and e2fsck consistent about allowing at most 50% of the blocks
authorTheodore Ts'o <tytso@mit.edu>
Thu, 6 Jan 2005 19:05:17 +0000 (14:05 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 6 Jan 2005 19:05:17 +0000 (14:05 -0500)
in a filesystem to be reserved for allocation by the root user.

e2fsck/ChangeLog
e2fsck/super.c
misc/ChangeLog
misc/tune2fs.c

index 25a6780..abcaf0a 100644 (file)
@@ -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  <tytso@mit.edu>
 
index ef799f9..2dff3b3 100644 (file)
@@ -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);
index e5bb292..df95b3f 100644 (file)
@@ -1,3 +1,10 @@
+2005-01-06  Theodore Ts'o  <tytso@mit.edu>
+
+       * 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  <tytso@mit.edu>
 
        * fsck.c (PRS): Apply Fedora's e2fsprogs-1.35-progress.patch from
index c300f27..92eee83 100644 (file)
@@ -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);