All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerry Lee <jerrylee@qnap.com>
To: linux-ext4@vger.kernel.org
Subject: resizing file system fails when file system block size is smaller than page size
Date: Fri, 9 Sep 2016 19:36:06 +0800	[thread overview]
Message-ID: <CAA1ppbijDUUH2AN40qkoC-w88sz6BBSz89rtvXPiT089pHYgqQ@mail.gmail.com> (raw)

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

             reply	other threads:[~2016-09-09 11:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09 11:36 Jerry Lee [this message]
2016-10-25 17:19 ` resizing file system fails when file system block size is smaller than page size Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA1ppbijDUUH2AN40qkoC-w88sz6BBSz89rtvXPiT089pHYgqQ@mail.gmail.com \
    --to=jerrylee@qnap.com \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.