]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
lockd: Move xdr.h from include/linux/lockd/ to fs/lockd/
authorChuck Lever <chuck.lever@oracle.com>
Wed, 28 Jan 2026 15:19:32 +0000 (10:19 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 30 Mar 2026 01:25:09 +0000 (21:25 -0400)
The lockd subsystem unnecessarily exposes internal NLM XDR type
definitions through the global include path. These definitions
are not used by any code outside fs/lockd/, making them
inappropriate for include/linux/lockd/.

Moving xdr.h to fs/lockd/ narrows the API surface and clarifies
that these types are internal implementation details. The
comment in linux/lockd/bind.h stating xdr.h was needed for
"xdr-encoded error codes" is stale: no lockd API consumers use
those codes.

Forward declarations for struct nfs_fh and struct file_lock are
added to bind.h because their definitions were previously pulled
in transitively through xdr.h. Additionally, nfs3proc.c and
proc.c need explicit includes of filelock.h for FL_CLOSE and
for accessing struct file_lock members, respectively.

Built and tested with lockd client/server operations. No
functional change.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/lockd/lockd.h
fs/lockd/xdr.h [moved from include/linux/lockd/xdr.h with 96% similarity]
fs/nfs/nfs3proc.c
fs/nfs/proc.c
include/linux/lockd/bind.h

index 460ccb70174968161050623bd9cdf4c63b5a719c..6f83b9a7257fe013f6d319a475b505cb943eacdd 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/refcount.h>
 #include <linux/utsname.h>
 #include <linux/lockd/bind.h>
-#include <linux/lockd/xdr.h>
+#include "xdr.h"
 #include <linux/sunrpc/debug.h>
 #include <linux/sunrpc/svc.h>
 
similarity index 96%
rename from include/linux/lockd/xdr.h
rename to fs/lockd/xdr.h
index 292e4e38d17d4773a2e0b46917cbc4a6cf69367a..af821ecf2a4e6d4eb65c5105044c08019bc31730 100644 (file)
@@ -1,14 +1,12 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /*
- * linux/include/linux/lockd/xdr.h
- *
  * XDR types for the NLM protocol
  *
  * Copyright (C) 1996 Olaf Kirch <okir@monad.swb.de>
  */
 
-#ifndef LOCKD_XDR_H
-#define LOCKD_XDR_H
+#ifndef _LOCKD_XDR_H
+#define _LOCKD_XDR_H
 
 #include <linux/fs.h>
 #include <linux/filelock.h>
@@ -110,4 +108,4 @@ bool        nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr);
 bool   nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr);
 bool   nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
 
-#endif /* LOCKD_XDR_H */
+#endif /* _LOCKD_XDR_H */
index be2aebf62056bd85e1a5ede1884e79b71d836b72..95d7cd564b7465463a94b77daa3975e728fc22a0 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/nfs3.h>
 #include <linux/nfs_fs.h>
 #include <linux/nfs_page.h>
+#include <linux/filelock.h>
 #include <linux/lockd/bind.h>
 #include <linux/nfs_mount.h>
 #include <linux/freezer.h>
index 8c3d2efa26365f8832b414cba48a5753fc33d560..70795684b8e8467192dd4b47b5c5117223e88c03 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/nfs2.h>
 #include <linux/nfs_fs.h>
 #include <linux/nfs_page.h>
+#include <linux/filelock.h>
 #include <linux/lockd/bind.h>
 #include <linux/freezer.h>
 #include "internal.h"
index 077da0696f12a737e83de6fec08d947f82a6d376..ba9258c96bfd48c4bcaf86ba7dee06ecd15cebb0 100644 (file)
 #define LINUX_LOCKD_BIND_H
 
 #include <linux/lockd/nlm.h>
-/* need xdr-encoded error codes too, so... */
-#include <linux/lockd/xdr.h>
 
-/* Dummy declarations */
+struct file_lock;
+struct nfs_fh;
 struct svc_rqst;
 struct rpc_task;
 struct rpc_clnt;