Repository navigation
nfsd: never wait for a layout break with an nfsd thread held in COPY - #31
Merged
Merged
Conversation
…n COPY A COPY into a file that still carries another client's pNFS write layout breaks that layout the same way an ordinary write does, and XFS waits for it with the calling thread held. Commit 3448b03 (pnfs-common: nfsd never waits for a layout break with a thread held) fixed this for nfsd_setattr, nfsd4_vfs_fallocate, and nfsd_vfs_write, but never reached nfsd_copy_file_range, which has the identical hazard. A synchronous COPY merely reproduces the bug 3448b03 fixed, bounded by nfsd's own layout-recall timeout. An asynchronous COPY does not: it runs in its own kthread rather than an nfsd thread, so the wait never times out, the kthread never reaches nfsd4_send_cb_offload, and the client's wait for CB_OFFLOAD in handle_async_copy never ends -- an uninterruptible wait that leaks the thread and its OS thread permanently. First seen as an S3 CompleteMultipartUpload that never returned: the join of two uploaded parts is a copy_file_range against the destination object's file, which still carried the write layout the gateway's own preceding writes had taken out on it. Every pNFS ReadWriteMany consumer is equally exposed, since an ordinary cp between two files on the same pNFS mount reaches the same copy_file_range. nfsd_copy_file_range now starts the break without waiting, like 3448b03's other three sites, and returns the error instead of blocking. nfsd4_do_copy already turns a negative return into an NFS4 error for both the synchronous and the asynchronous caller, so no further plumbing is needed.
boddumanohar
approved these changes
Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
nfsd_copy_file_range(fs/nfsd/vfs.c) is missing the non-blocking layout-breakguard that commit
3448b03(nfsd: never wait for a layout break with an nfsd thread held) added tonfsd_setattr,nfsd4_vfs_fallocate, andnfsd_vfs_write. A server-sideCOPYinto a file that still carries anotherclient's pNFS write layout breaks that layout the same way a write does, and
the filesystem waits for it with the calling thread held.
For a synchronous
COPYthis reproduces the bug3448b03fixed, bounded bynfsd's layout-recall timeout. For an asynchronous
COPYit does not: the copyruns in its own kthread (
nfsd4_do_async_copy), so nothing times it out, thekthread never reaches
nfsd4_send_cb_offload, and the client'shandle_async_copywaits forCB_OFFLOADthat never arrives. The wait isuninterruptible, so the thread and its OS thread leak permanently, and every
later operation on the same mount blocks behind it.
First seen as an S3
CompleteMultipartUploadthat never returned: thegateway's join of two uploaded parts is a
copy_file_rangeagainst thedestination object's file, which still carried the write layout its own
preceding writes had taken out on it. Every pNFS ReadWriteMany consumer is
exposed; an ordinary
cpbetween two files on the same mount reaches thesame code path.
Fix
nfsd_copy_file_rangenow callsbreak_layout(file_inode(dst), false)beforethe copy, like the other three sites.
nfsd4_do_copyalready turns anegative return into an NFS4 error for both the synchronous and the
asynchronous caller, so no further plumbing is needed.
Verification
Not yet run against a booted guest. This patch is written against this
repository's local Linux 6.14 reference tree as a stand-in for the actual
6.18.55 base, since that source was not available to build or boot against
while preparing this.
break_layout(inode, bool wait)is not defined by anypatch in this series — it must already exist in the 6.18.55 base, since
3448b03calls it with the same signature — so this patch only adds a fourthcall site in the same idiom, but the context around it should be checked
against the real source before merging, and the hang reproduction (
cpbetween two files on a pNFS RWX mount while the destination holds an open
write layout) should be run against a built guest once the test deployment
for this is ready.
Full investigation:
pnfs-copy-offload-hang.mdinsimplyblock-operator(branch
copy-file-range).