[PATCH v2 00/10] nfsd: copy offload fixes

From: Jeff Layton

Date: Thu Jul 09 2026 - 14:52:41 EST


These patches fix bugs in inter-server copy offload code noticed by LLM
inspection. The first 3 were found via kres, and the next 5 were
problems that were flagged in agentic review of those patches and some
via testing.

The last 3 patches attempt to rework the code to be less problematic in
the future. It breaks up the nfsd4_copy object into two separate objects
with well-defined lifetimes, and then integrates the COPY stateids into
the normal nfs4_stid model. The idea is to bring clarity to the copy
object lifetimes that was the underlying cause of most of these bugs.

As part of this work, I've had Claude cook up a set of pynfs tests for
COPY that I'll post separately.

Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
Changes in v2:
- Add new patches to fix neighboring bugs found via testing and LLM review
- Fix error return when given NL_NAME or NL_URL netlocs
- Split nfsd4_copy into transient and durable async copy objects
- Rework COPY stateids to use normal stateid infrastructure
- Link to v1: https://lore.kernel.org/r/20260624-nfsd-testing-v1-0-b8853eb22e45@xxxxxxxxxx

---
Chris Mason (1):
nfsd: fix cpntf publish race in nfs4_init_cp_state

Jeff Layton (9):
nfsd: fix UAF in async copy cancel and shutdown
nfsd: fix stale s2s_cp_stateids IDR entry for async COPY
nfsd: initialize copy-notify stateid before publishing it
nfsd: check client ownership when cancelling a copy-notify stateid
nfsd: revoke copy-notify stateids before dropping their reference
nfsd: return NFS4ERR_NOTSUPP for unsupported netloc4 types
nfsd: split nfsd4_copy into transient and durable async copy objects
nfsd: make the copy offload stateid a first-class nfs4_stid
nfsd: drop dead COPY-vs-COPYNOTIFY type handling from s2s stateid IDR

fs/nfsd/nfs4proc.c | 311 ++++++++++++++++++++++++++++++++++------------------
fs/nfsd/nfs4state.c | 224 +++++++++++++++++++++++++++++--------
fs/nfsd/nfs4xdr.c | 15 +++
fs/nfsd/state.h | 6 +-
fs/nfsd/xdr4.h | 33 ++++--
5 files changed, 429 insertions(+), 160 deletions(-)
---
base-commit: bc7d6a41a6282da7c175c1638bdfef69c10f78d5
change-id: 20260624-nfsd-testing-8439f0163312

Best regards,
--
Jeff Layton <jlayton@xxxxxxxxxx>