]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
resize2fs: enforce the 16TB limit on 32-bit file systems correctly
authorTheodore Ts'o <tytso@mit.edu>
Fri, 7 Sep 2012 04:05:21 +0000 (00:05 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 14 Sep 2012 03:04:44 +0000 (23:04 -0400)
The 16TB limit must be enforced regardless of whether the new size is
specified on the command line or implied by the size of the device,
but only if the file system does not support 64-bit block sizes, or
the kernel does not advertise support of meta_bg resizing.

Previously we were unconditionally enforcing it when it was implied by
the device size, but not if the new size was specified on the command
line.

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

index e6604f2870f0741214637cddc310c18bfa1e435b..228e85ab4eb7f2fd66dc78c0e8de4860d512dc0b 100644 (file)
@@ -385,19 +385,23 @@ int main (int argc, char ** argv)
                        exit(1);
                }
        } else {
-               /* Take down devices exactly 16T to 2^32-1 blocks */
-               if (max_size == (1ULL << 32))
-                       max_size--;
-               else if (max_size > (1ULL << 32)) {
-                       com_err(program_name, 0, _("New size too large to be "
-                               "expressed in 32 bits\n"));
-                       exit(1);
-               }
                new_size = max_size;
                /* Round down to an even multiple of a pagesize */
                if (sys_page_size > fs->blocksize)
                        new_size &= ~((sys_page_size / fs->blocksize)-1);
        }
+       if (!EXT2_HAS_INCOMPAT_FEATURE(fs->super,
+                                      EXT4_FEATURE_INCOMPAT_64BIT)) {
+               /* Take 16T down to 2^32-1 blocks */
+               if (new_size == (1ULL << 32))
+                       new_size--;
+               else if (new_size > (1ULL << 32)) {
+                       com_err(program_name, 0,
+                               _("New size too large to be "
+                                 "expressed in 32 bits\n"));
+                       exit(1);
+               }
+       }
 
        if (!force && new_size < min_size) {
                com_err(program_name, 0,