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=1796290215; b=gmwYR7LPu+WCWrNG1jMUzYkkfesbFYQTPyKjDqseT6Bmy4KrWW90Q2RHPdrG0Vp253Ua DeSfHdwp//LeNV+WXWA5bJA9svzle5UbhyRKs227d9wzR7yvZs6I7uHtg83n3M8AazNGM KaI998p0l1j7VRE9w95COlaQB9DjrCRRweuky2z8UL7HttOejDW94pX4C5y4DHhu4D0X+ gV4NlfGn1WBqNNU4Z/JyMVgSoMKxFw1QJTCQCltcpgk+bE35BeInfJeF8dqygcqknpypw 0H4+Pd6UXylJAvILtGMtqtz1xUG/6aTpPQbRFIpzmXDmXm3IumPJ8HW7L0cpEbJXxcg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796290215; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=unqRygJXQ9+C4RGHiiAIt5bQteP7OycsZ7aDHALSWYA=; b=TTVm1ZnmYNcBXHKrVYVsjglec6GEAWr17ts37lvRWgvIo2hcIkR6nMiqYtgNfm7G7PcB m5UJwO8jKLyYNTfODP7zv24AcNFPRfT3cuqTMdr8vaXtnW9KxM1d4E8pCiQxeYg6av4Jf jpIKNxvVVVuBsR6k1Ee707Z9gyUTeYDPxoOWMoDGj0B3wDHjrrBTqvgMwJaD9MDjvuikn 2YFP0Kh8MQLbkvBGyCJN79+6PLuP/5AoD8xVJxq5PnYDU8/bFY9G2TuNeexvCxuq5gDqq 3WavET5iRH2EAWq51b75g5X/9TS2Z9FGZAAtSKLKzvp2JNzNlWh/4vsUiKy6Z8zNNPQ== 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=epeDv6ur; 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 E3D2C606A32D for ; Thu, 3 Dec 2026 09:30:14 +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=epeDv6ur Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BD531F00896; Thu, 3 Dec 2026 09:30:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796290214; bh=unqRygJXQ9+C4RGHiiAIt5bQteP7OycsZ7aDHALSWYA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=epeDv6urzVxYa5OmsuZKmxBC6eyNzUDkaxz0ZCnJgmDffOXNWRV8baeoHgTlY2KzE 8HyoplEnmYU33RHYxTi+WnQKmTSA6QRDeUoNz1ss80fQUxczEMjzaF/spcsBcbP3MT /dZaxqbt7OVqqL0eT19EPP/d+Nd+vGCNrJiU8ZKq2zRzJgbr+1ax8y6Yx+E7nn/dvm br8UF/4Vtw7NioJ2n3XPv5gMHIxA6QSU0OLZ6I/YIUq4SjgXnUnDSMkHEhuwLCOk+I dmT2UeLBwXdMLR9sR+Reyfj2QSp+wWcDMqZj35vNPjAD6Y7ura+Upm4yqpLUg4BVoR tCZ5uNtDYJ6Yg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] generic: punch a hole past EOF over preallocated blocks Reply-To: sashiko-reviews@lists.linux.dev To: "Ding Feng" Cc: linux-ext4@vger.kernel.org, tytso@mit.edu In-Reply-To: <20261203091452.74081-1-dingf3ng@gmail.com> References: <20261203091452.74081-1-dingf3ng@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 09:30:14 +0000 X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] fstests: stat -c %b limit in generic/810 ignores inode metadata blocks - [Medium] fstests: hardcoded 4k/1m offsets in generic/810 ignore file block size - [Low] fstests: generic/810 leaves TEST_DIR test file behind without _cleanup() -- commit ddbdf0d7928967d0167f771003c32e951506eb24 Author: Ding Feng generic: punch a hole past EOF over preallocated blocks This commit adds fstest generic/810 to verify that punching a hole past EOF frees blocks preallocated with FALLOC_FL_KEEP_SIZE without changing the file size or data below EOF. > diff --git a/tests/generic/810 b/tests/generic/810 > new file mode 100755 > index 0000000000000..60f92b38a270f > --- /dev/null > +++ b/tests/generic/810 [ ... ] > +file=3D$TEST_DIR/$seq.file > +rm -f $file [Severity: Low] Should this test override _cleanup() to remove $file on exit? TEST_DIR persists across tests, and the default _cleanup() only removes $tmp.*, leaving $TEST_DIR/$seq.file behind after every run or interruption. > + > +$XFS_IO_PROG -f -c "pwrite -S 0x61 0 4k" -c "falloc -k 0 1m" -c fsync \ > + $file >> $seqres.full > +before=3D$(md5sum < $file) > + > +$XFS_IO_PROG -c "fpunch 4k 1020k" -c fsync $file >> $seqres.full > + > +bs=3D$(_get_file_block_size $TEST_DIR) [Severity: Medium] Can the hardcoded 4k, 1m, and 1020k offsets cause false failures or vacuous passes depending on the file block size? When bs does not divide 1m (such as an XFS realtime volume with a 12k rextsize), xfs_bmap_extsize_align() rounds the falloc end past 1m while xfs_free_file_space() rounds the fpunch end down, leaving the trailing extent allocated and exceeding limit on a working filesystem. When bs is 1m or larger (such as ext4 bigalloc or XFS rextsize >=3D 1m), both pwrite and falloc fit in the first allocation unit. Because the test never checks allocated blocks before fpunch, it passes vacuously even on a buggy kernel. Querying bs first, scaling the write, preallocation, and punch ranges to multiples of bs, and verifying that blocks past EOF were allocated before punching would avoid both issues. > +limit=3D$(( (4096 + bs - 1) / bs * bs )) > +allocated=3D$(( $(stat -c %b $file) * 512 )) > +[ $allocated -le $limit ] || \ > + echo "$allocated bytes allocated after punching past EOF, expected at m= ost $limit" [Severity: Medium] Can this stat -c %b check fail spuriously because st_blocks includes per-inode metadata blocks? On ext4 with 128-byte inodes under SELinux or default ACLs, ext4_xattr_block_set() charges an external xattr block to i_blocks (and XFS similarly includes out-of-line attribute fork blocks in xfs_vn_getattr()). On a fragmented TEST_DIR, ext4_ext_grow_indepth() can also allocate an extent-tree block that ext4_ext_remove_space() retains while the first extent remains, leaving allocated above limit even when all post-EOF data blocks are freed. Checking data extents past EOF directly (for example with xfs_io fiemap) or accounting for metadata blocks would avoid these false failures. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203091452.7408= 1-1-dingf3ng@gmail.com?part=3D1