public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Josh Triplett <josh@joshtriplett.org>
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andreas Dilger <adilger.kernel@dilger.ca>
Subject: Re: [PATCH 2/2] fs: ext4: Add check to prevent attempting to resize an fs with sparse_super2
Date: Thu, 24 Jun 2021 10:23:29 -0400	[thread overview]
Message-ID: <YNSVYTq/ovC6sEAT@mit.edu> (raw)
In-Reply-To: <74b8ae78405270211943cd7393e65586c5faeed1.1623093259.git.josh@joshtriplett.org>

On Mon, Jun 07, 2021 at 12:15:24PM -0700, Josh Triplett wrote:
> The in-kernel ext4 resize code doesn't support filesystem with the
> sparse_super2 feature. It fails with errors like this and doesn't finish
> the resize:
> EXT4-fs (loop0): resizing filesystem from 16640 to 7864320 blocks
> EXT4-fs warning (device loop0): verify_reserved_gdb:760: reserved GDT 2 missing grp 1 (32770)
> EXT4-fs warning (device loop0): ext4_resize_fs:2111: error (-22) occurred during file system resize
> EXT4-fs (loop0): resized filesystem to 2097152
> 
> To reproduce:
> mkfs.ext4 -b 4096 -I 256 -J size=32 -E resize=$((256*1024*1024)) -O sparse_super2 ext4.img 65M
> truncate -s 30G ext4.img
> mount ext4.img /mnt
> python3 -c 'import fcntl, os, struct ; fd = os.open("/mnt", os.O_RDONLY | os.O_DIRECTORY) ; fcntl.ioctl(fd, 0x40086610, struct.pack("Q", 30 * 1024 * 1024 * 1024 // 4096), False) ; os.close(fd)'
> dmesg | tail
> e2fsck ext4.img
> 
> The userspace resize2fs tool has a check for this case: it checks if the
> filesystem has sparse_super2 set and if the kernel provides
> /sys/fs/ext4/features/sparse_super2. However, the former check requires
> manually reading and parsing the filesystem superblock.
> 
> Detect this case in ext4_resize_begin and error out early with a clear
> error message.
> 
> Signed-off-by: Josh Triplett <josh@joshtriplett.org>

Applied, thanks.

					- Ted

  reply	other threads:[~2021-06-24 14:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 19:15 [PATCH 1/2] fs: ext4: Consolidate checks for resize of bigalloc into ext4_resize_begin Josh Triplett
2021-06-07 19:15 ` [PATCH 2/2] fs: ext4: Add check to prevent attempting to resize an fs with sparse_super2 Josh Triplett
2021-06-24 14:23   ` Theodore Ts'o [this message]
2021-06-24 14:23 ` [PATCH 1/2] fs: ext4: Consolidate checks for resize of bigalloc into ext4_resize_begin Theodore Ts'o
2021-07-01  0:48   ` Theodore Ts'o
2021-07-01  2:17     ` Josh Triplett
2021-07-01 14:41       ` 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=YNSVYTq/ovC6sEAT@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger.kernel@dilger.ca \
    --cc=josh@joshtriplett.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox