resizing file system fails when file system block size is smaller than page size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have a file system with 4K block size on a 32K page size platform, and
something strange happened when expanding the file system from size 17TB to
20TB.  It seems that the new file system size is not calculated correctly.

$ resize2fs /dev/mapper/dev
resize2fs 1.43.3 (04-Sep-2016)
Filesystem at /dev/mapper/dev is mounted on /share/DATA; on-line
resizing required
resize2fs: On-line shrinking not supported

After digging into the issue, I find that the following operation makes the
high 32bit of the new_size variable be wiped out and results in a smaller
size compared to the currently used block counts.  Here's the patch:

diff --git a/resize/main.c b/resize/main.c
index 5a99483..396391b 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -505,7 +505,7 @@ int main (int argc, char ** argv)
                new_size = max_size;
                /* Round down to an even multiple of a pagesize */
                if (sys_page_size > blocksize)
-                       new_size &= ~((sys_page_size / blocksize)-1);
+                       new_size &= ~((blk64_t)((sys_page_size / blocksize)-1));
        }
        /* If changing 64bit, don't change the filesystem size. */
        if (flags & (RESIZE_DISABLE_64BIT | RESIZE_ENABLE_64BIT)) {


Thanks!


- Jerry
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux