[PATCH 0/4] Confine the inter-server copy interface to fs/nfs_common
Chuck Lever <[email protected]> Tue, 21 Jul 2026 12:23:02 -0400
| Newsgroups | gmane.linux.nfs |
|---|---|
| Message-ID | <[email protected]> |
Inter-server copy has drawn a steady trail of use-after-free and reference-leak fixes: 75333d48f922, 34e8f9ec4c9a, and d2c343c51caf among them. They cluster on one object, the source mount that the NFS client creates and opens while NFSD decides when it may be torn down. The bookkeeping that tracks it, added by f4e44b393389, has needed three follow-on repairs of its own. Splitting an object's lifetime across two modules that are forbidden to call each other directly is what keeps producing these bugs. The fix in 75333d48f922 narrowed that split rather than adding another rule to it. NFSD stopped reaching back through the broker to deactivate the source superblock, and post-copy clean-up became the laundromat's business alone. What the fix did not do was retract the interface it had just stopped using, so the client-side registration machinery has sat unused since (patch 1). One implicit contract between the two modules is still in force. Reading the client ops table without synchronization is safe only for reasons that live on the caller's side: an inter-server copy holds an active vers=4.2 mount of the source, that mount pins the nfsv4 module, and unregister runs only at module exit. Patch 3 replaces that with synchronization the broker owns, so the argument no longer depends on how a caller in another subsystem manages mounts. What remains after that is textual. The header still declares both sides' interfaces, so each implementation parses the other's types and inherits its includes, which is how <uapi/linux/nfs.h> reaches nfs4proc.c. Once the knowledge only NFSD holds has moved into the broker, splitting that header is mechanical. None of this fixes a live bug, and the source mount's lifetime still spans both modules. What changes is that the broker no longer relies on rules its callers enforce. Inter-server copy behavior is meant to be unchanged throughout. Chuck Lever (4): nfs_common: Remove unused nfs_ssc_client_ops infrastructure NFSD: Hoist nfs42_ssc_open() into fs/nfs_common/nfs_ssc.c nfs_common: Synchronize access to the SSC client ops table NFSD: Split linux/nfs_ssc.h fs/nfs/nfs4file.c | 1 + fs/nfs/super.c | 25 -------- fs/nfs_common/nfs_ssc.c | 126 ++++++++++++++++++++++++--------------- fs/nfsd/nfs4proc.c | 22 ++----- fs/nfsd/nfs4state.c | 2 +- fs/nfsd/xdr4.h | 13 ++++ include/linux/nfs_ssc.h | 69 ++++----------------- include/linux/nfsd_ssc.h | 38 ++++++++++++ 8 files changed, 147 insertions(+), 149 deletions(-) create mode 100644 include/linux/nfsd_ssc.h -- 2.54.0