summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorWeston Andros Adamson <dros@primarydata.com>2024-09-05 15:09:50 -0400
committerAnna Schumaker <anna.schumaker@oracle.com>2024-09-23 15:03:30 -0400
commitfa4983862e506d395acc1b8d14dbebf63acc2e82 (patch)
tree0c862a0f31a5023b451f3489be653546a093da17 /include
parenta61e147e6be6e763d9c6dec8061d2893c0bb3423 (diff)
nfsd: add LOCALIO support
Add server support for bypassing NFS for localhost reads, writes, and commits. This is only useful when both the client and server are running on the same host. If nfsd_open_local_fh() fails then the NFS client will both retry and fallback to normal network-based read, write and commit operations if localio is no longer supported. Care is taken to ensure the same NFS security mechanisms are used (authentication, etc) regardless of whether localio or regular NFS access is used. The auth_domain established as part of the traditional NFS client access to the NFS server is also used for localio. Store auth_domain for localio in nfsd_uuid_t and transfer it to the client if it is local to the server. Relative to containers, localio gives the client access to the network namespace the server has. This is required to allow the client to access the server's per-namespace nfsd_net struct. This commit also introduces the use of NFSD's percpu_ref to interlock nfsd_destroy_serv and nfsd_open_local_fh, to ensure nn->nfsd_serv is not destroyed while in use by nfsd_open_local_fh and other LOCALIO client code. CONFIG_NFS_LOCALIO enables NFS server support for LOCALIO. Signed-off-by: Weston Andros Adamson <dros@primarydata.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Co-developed-by: Mike Snitzer <snitzer@kernel.org> Signed-off-by: Mike Snitzer <snitzer@kernel.org> Co-developed-by: NeilBrown <neilb@suse.de> Signed-off-by: NeilBrown <neilb@suse.de> Reviewed-by: Jeff Layton <jlayton@kernel.org> Acked-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/nfslocalio.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/nfslocalio.h b/include/linux/nfslocalio.h
index 1a39d7d727bd..546f46b4e46f 100644
--- a/include/linux/nfslocalio.h
+++ b/include/linux/nfslocalio.h
@@ -6,6 +6,8 @@
#ifndef __LINUX_NFSLOCALIO_H
#define __LINUX_NFSLOCALIO_H
+#if IS_ENABLED(CONFIG_NFS_LOCALIO)
+
#include <linux/module.h>
#include <linux/list.h>
#include <linux/uuid.h>
@@ -58,4 +60,10 @@ struct nfsd_localio_operations {
extern void nfsd_localio_ops_init(void);
extern const struct nfsd_localio_operations *nfs_to;
+#else /* CONFIG_NFS_LOCALIO */
+static inline void nfsd_localio_ops_init(void)
+{
+}
+#endif /* CONFIG_NFS_LOCALIO */
+
#endif /* __LINUX_NFSLOCALIO_H */