From: Chao Yu <chao@kernel.org>
To: Hengyu Liang <hengyul@cs.unc.edu>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: chao@kernel.org, Taerang Kim <kth5965@gmail.com>,
linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] f2fs: fix to reject inline_data inode which has blocks
Date: Tue, 1 Dec 2026 16:15:01 +0800 [thread overview]
Message-ID: <11c9935a-044a-4ac4-85ee-592d6aca3c81@kernel.org> (raw)
In-Reply-To: <20261122153636.2731348-1-hengyul@cs.unc.edu>
On 11/22/26 23:36, Hengyu Liang wrote:
> Commit c240c87bcd44 ("f2fs: fix to do sanity check on blocks for
> inline_data inode") made f2fs_sanity_check_inline_data() return false,
> i.e. "sane", as soon as an inline_data inode has blocks or node ids.
>
> However, the function returns true for a corrupted inode, and that
> commit meant to detect exactly this state. The early return also skips
> the older checks that reject inline_data on a directory and on a
> compressed, encrypted or verity file. As of now, such an inode on a
> corrupted image is loaded, and setting this one bit in i_inline of an
> inode is enough for the following:
>
> - unlink() of a small compressed file that owns one data block hits
> BUG_ON() in clear_inode(). With panic_on_oops=1 the machine panics.
> Otherwise the task is killed, and the file system can no longer be
> unmounted (EBUSY).
> - unlink() of a larger compressed file succeeds, but the orphan inode
> cannot be evicted, and the next mount fails with EIO until fsck.f2fs
> repairs the image.
> - A directory lists only 70 of its 300 entries, yet rmdir removes it
> once those 70 are deleted, and fsck.f2fs then finds the other 230
> inodes unreachable.
>
> The issue can be reproduced with:
>
> mkfs.f2fs -q -f -O extra_attr,compression /dev/vda
> mount -t f2fs -o compress_algorithm=lz4 /dev/vda /mnt
> touch /mnt/f; chattr +c /mnt/f; echo hello > /mnt/f; sync
> ino=$(ls -i /mnt/f | awk '{print $1}'); umount /mnt
> blk=$(dump.f2fs -d 1 -i $ino /dev/vda |
> sed -n 's/.*nat_entry.block_addr *\[0x\(.*\)\]/\1/p')
> # i_inline 0x21 -> 0x23 (F2FS_INLINE_DATA)
> printf '\043' | dd of=/dev/vda bs=1 seek=$((0x$blk * 4096 + 3)) \
> conv=notrunc
> mount -t f2fs /dev/vda /mnt; rm /mnt/f
>
> Before that commit, the result is:
>
> rm: can't stat '/mnt/f': Structure needs cleaning
>
> After it, the result is:
>
> kernel BUG at fs/inode.c:776!
>
> With this patch, the result is the same as before that commit.
>
> This patch will make the check return true for an inline_data inode
> which has blocks, as the message of that commit describes.
>
> Fixes: c240c87bcd44 ("f2fs: fix to do sanity check on blocks for inline_data inode")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hengyu Liang <hengyul@cs.unc.edu>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
prev parent reply other threads:[~2026-12-01 8:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 15:36 [PATCH] f2fs: fix to reject inline_data inode which has blocks Hengyu Liang
2026-12-01 8:15 ` Chao Yu [this message]
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=11c9935a-044a-4ac4-85ee-592d6aca3c81@kernel.org \
--to=chao@kernel.org \
--cc=hengyul@cs.unc.edu \
--cc=jaegeuk@kernel.org \
--cc=kth5965@gmail.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@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