All of lore.kernel.org
 help / color / mirror / Atom feed
* resizing file system fails when file system block size is smaller than page size
@ 2016-09-09 11:36 Jerry Lee
  2016-10-25 17:19 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Jerry Lee @ 2016-09-09 11:36 UTC (permalink / raw)
  To: linux-ext4

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: resizing file system fails when file system block size is smaller than page size
  2016-09-09 11:36 resizing file system fails when file system block size is smaller than page size Jerry Lee
@ 2016-10-25 17:19 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2016-10-25 17:19 UTC (permalink / raw)
  To: Jerry Lee; +Cc: linux-ext4

On Fri, Sep 09, 2016 at 07:36:06PM +0800, Jerry Lee wrote:
> 
> 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.

Thanks for the report; I've applied your suggested fix.

       	       	       	    	    - Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-25 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-09 11:36 resizing file system fails when file system block size is smaller than page size Jerry Lee
2016-10-25 17:19 ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.