summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorChuck Lever <cel@kernel.org>2026-09-16 12:28:39 -0400
committerChuck Lever <cel@kernel.org>2026-10-11 23:12:24 -0400
commit092ffaedb9f50293c806baf213803b9430e4866c (patch)
tree6e1de5ce8ab57bc0e673b864a6a35aa51bc56613 /tools/lib/python
parent48e8a88b89aa56674fff36d1b61ca27f45268091 (diff)
downloadlinux-next-092ffaedb9f50293c806baf213803b9430e4866c.tar.gz
linux-next-092ffaedb9f50293c806baf213803b9430e4866c.zip
NFSD: Use xdrgen XDR functions for NFSv2 SETATTR procedure
Replace the NFSPROC_SETATTR entry in the nfsd_procedures2 array with an entry that dispatches the xdrgen-generated nfs_svc_decode_sattrargs and nfs_svc_encode_attrstat. Wrapper structures bridge the generated xdrgen types and the legacy svc_fh, iattr, and kstat representations the NFSD VFS layer still uses. The result reuses the attrstat wrapper from the GETATTR conversion; the new nfsd_sattr_to_iattr() and nfsd_timeval_to_timespec64() helpers translate the decoded sattr into the iattr that nfsd_setattr() consumes. The hand-coded svcxdr_decode_sattr() rejects a time-useconds value greater than one second before converting it, preventing the microsecond-to-nanosecond multiplication from wrapping to a valid but incorrect value on 32-bit platforms. nfsd_sattr_to_iattr() preserves that range check. Because it runs after the generated decoder rather than inside it, an out-of-range value fails the procedure with nfserr_io rather than the RPC GARBAGE_ARGS the hand-coded decoder returned. The pc_argzero field is now set to zero for the NFSv2 SETATTR procedure. The xdrgen decoders are trusted to initialize all arguments in the argp->xdrgen field, making the early defensive memset unnecessary. The remaining argp fields are cleared as needed. The wrapper's iattr is one of them: nfsd_sattr_to_iattr() zeroes the whole structure rather than only ia_valid, because the nfsd_vfs_setattr tracepoint records ia_size, ia_uid, and ia_gid whether or not their ATTR bits are set. This refactor replaces the use of svcxdr_encode_fattr(), so the reference to the file handle can be released directly by nfsd_proc_setattr(). A separate ->pc_release callback is thus no longer needed. This makes it straightforward to confirm that the file handle is properly released during every error flow. Acked-by: Jeff Layton <jlayton@kernel.org> Link: https://patch.msgid.link/20260916162859.2051-11-cel@kernel.org Signed-off-by: Chuck Lever <cel@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions