From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796112905; b=dqzp+XHeSQiVXR3eVAWgmBSDpEPCcEV5mEyvw3mLpDUqt2Mwqk7RsWW/vlJG9NJIYGN7 4Gok9scmB4ne/Wm4hWWo7XytlVYQmSWJTxSj6siG5gw9r+G2Purc347DFur+/wDdINiO2 1bbaYr2BxQWoH32DMzpMwc2qUNtEqMF+eHcpKx8Ogl6X8c/Z7vD8cWqb9XgF57s6QFqQA NFnf1dUhD37rWAqhgFNX+46f2nH/hlhJmMkzKRkwpSTL60WrgsDGwIXrtterMmrq0QndR 818FfvICOjrJ0R3dqviViYYb8P6N61WvQyoQruhx0VzvEKPK9A3Bwq1Hxjs42UPKaiQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796112905; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent:Cc: Subject:To:References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=K3MJDkrfpJVG4TLJ+i5YsRJkNbYgSnm6CMfrxts6xLY=; b=yb5PiCQMAsnVGPsQqQL/I04HTtEfoHcX/1m/bI0/JnH0Ome9lZVKTWwJ70g/YgB1E7+U T5OFOrTjkG/DA+yzYtunhOxzEMG6soCKublGzKh0vnCj7mSPku7rL9E3fh1U5dPEah//A I10ATFDAeh1/yWHTDXDlScSLbvia07goDRdUuiB1HLRB2qlM3Jlacx+V5xij5yuo+aVwP sEiTfPylQvqkbWqihUzJaRpw8uJ7DYaYdwkdApuDT9rRrAOELB/JrPY5z7JjiE1925I8W SA9dlPDKsiTFGjKJZwzNJ/OVHURTd13YWUWjpebNSykfSjBMgZVT1IL/DVSQhdk3L5Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Yz1DjiRu; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF368606A320; Tue, 1 Dec 2026 08:15:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Yz1DjiRu Received: by smtp.kernel.org (Postfix) with ESMTPSA id 210541F00893; Tue, 1 Dec 2026 08:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796112904; bh=K3MJDkrfpJVG4TLJ+i5YsRJkNbYgSnm6CMfrxts6xLY=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=Yz1DjiRu/RmtONoNlUmU6Ow9xC3F6/h/g7REJDtngNIH3u1JgkBKgtSb3trxlmXrx 87vXVM32qYpQTjuY+mQ6j3adS8fMeKP5cdYmSOmBBlDRi48Juz6srvfp7m4FH0OAZn ODnQudhPSZ33NChPTJaPx6Mz+tCNEbk2JCzLXoGdoJR2MxCR7D4ivTPvo312MG2iNN eHqAHrbRa3eU7qNwO9VisSLtfxImbB14H9oOWMa1vDXdTTpG5v3HMgizVAsuWHAoPf a2icxf3OOTafjWLMoVKqQoe8YK8Z8urnqSChZa6Tlt3q1Ago8PxcNeUfs8JpGwOIIH Ffqy5aFCs1P6Q== Message-ID: <11c9935a-044a-4ac4-85ee-592d6aca3c81@kernel.org> Date: Tue, 1 Dec 2026 16:15:01 +0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, Taerang Kim , 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 To: Hengyu Liang , Jaegeuk Kim References: <20261122153636.2731348-1-hengyul@cs.unc.edu> Content-Language: en-US From: Chao Yu In-Reply-To: <20261122153636.2731348-1-hengyul@cs.unc.edu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 Reviewed-by: Chao Yu Thanks,