* [PATCH] nfsd: stop a block layout at the maximum file size
@ 2026-11-26 1:45 Daejun Park via B4 Relay
2026-11-28 18:30 ` Chuck Lever
2026-11-30 13:02 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Daejun Park via B4 Relay @ 2026-11-26 1:45 UTC (permalink / raw)
To: Chuck Lever, Jeff Layton
Cc: NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Christoph Hellwig, Sergey Bashirov, linux-nfs, Daejun Park
From: Daejun Park <daejun7.park@samsung.com>
nfsd4_block_proc_layoutget() calls ->map_blocks again for the rest of
the range after each extent. If the range runs past the maximum file
size, an extent from XFS reaches that size. The next call then asks
for an offset at or past it. Since commit 29f3c1be4e55 ("xfs: clamp
the pNFS layout range to the maximum file size"), xfs_fs_map_blocks()
rejects such an offset with -EINVAL. The LAYOUTGET then fails with
NFS4ERR_INVAL. pynfs GETLAYOUT1, a READ for NFS4_UINT64_MAX, fails
this way.
Stop the loop at an extent that reaches the maximum file size.
Fixes: cc6c40e09d7b ("NFSD/blocklayout: Support multiple extents per LAYOUTGET")
Signed-off-by: Daejun Park <daejun7.park@samsung.com>
---
pynfs GETLAYOUT1 and a READ for NFS4_UINT64_MAX at offset 4096 of a
64 KiB file now get a layout up to 2^63. fstests generic/075, 091 and
263 over the block and SCSI layouts, and the pynfs block tests over
the block layout, give the same results as on nfsd-testing (generic/075
fails with fsx errors on both).
7.4 and 7.3.y (with the backport of 29f3c1be4e55) return the
NFS4ERR_INVAL, so they may want this in stable. Older LTS kernels map
one extent per LAYOUTGET.
---
fs/nfsd/blocklayout.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c
index 23f2365787e..c8942191b5f 100644
--- a/fs/nfsd/blocklayout.c
+++ b/fs/nfsd/blocklayout.c
@@ -182,7 +182,9 @@ nfsd4_block_proc_layoutget(struct svc_rqst *rqstp, struct inode *inode,
}
bex_length = bex->len - (offset - bex->foff);
- if (bex_length >= length) {
+ /* There is nothing to map past the maximum file size. */
+ if (bex_length >= length ||
+ bex->foff + bex->len >= inode->i_sb->s_maxbytes) {
bl->nr_extents = i + 1;
break;
}
---
base-commit: 6f174a0eca19e69a14c34b0ed56b60d484f22fd6
change-id: 20261126-nfsd-block-maxbytes-25f7755db30a
Best regards,
--
Daejun Park <daejun7.park@samsung.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nfsd: stop a block layout at the maximum file size
2026-11-26 1:45 [PATCH] nfsd: stop a block layout at the maximum file size Daejun Park via B4 Relay
@ 2026-11-28 18:30 ` Chuck Lever
2026-11-30 13:02 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Chuck Lever @ 2026-11-28 18:30 UTC (permalink / raw)
To: Jeff Layton, Daejun Park
Cc: NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
Christoph Hellwig, Sergey Bashirov, linux-nfs
On Thu, 26 Nov 2026 10:45:24 +0900, Daejun Park wrote:
> nfsd4_block_proc_layoutget() calls ->map_blocks again for the rest of
> the range after each extent. If the range runs past the maximum file
> size, an extent from XFS reaches that size. The next call then asks
> for an offset at or past it. Since commit 29f3c1be4e55 ("xfs: clamp
> the pNFS layout range to the maximum file size"), xfs_fs_map_blocks()
> rejects such an offset with -EINVAL. The LAYOUTGET then fails with
> NFS4ERR_INVAL. pynfs GETLAYOUT1, a READ for NFS4_UINT64_MAX, fails
> this way.
>
> [...]
Applied to nfsd-testing, thanks!
[1/1] nfsd: stop a block layout at the maximum file size
commit: 4f39cd2ac673848bd39cee50d7c5f75a1288a171
--
Chuck Lever
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nfsd: stop a block layout at the maximum file size
2026-11-26 1:45 [PATCH] nfsd: stop a block layout at the maximum file size Daejun Park via B4 Relay
2026-11-28 18:30 ` Chuck Lever
@ 2026-11-30 13:02 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-11-30 13:02 UTC (permalink / raw)
To: daejun7.park
Cc: Chuck Lever, Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo,
Tom Talpey, Sergey Bashirov, linux-nfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-30 13:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 1:45 [PATCH] nfsd: stop a block layout at the maximum file size Daejun Park via B4 Relay
2026-11-28 18:30 ` Chuck Lever
2026-11-30 13:02 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox