[pnfs] [PATCH 04/12] [FIXME] pnfsd-lexp: local sockaddr hack

Benny Halevy bhalevy at panasas.com
Mon Jun 16 14:25:03 EDT 2008


Save the local addr at create_session time.
This address will be used later to generate the DS address
(which is the same as the MDS's)

FIXME: the MDS address should be managed per-client mount point.

Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfsd/nfs4state.c        |    7 +++++++
 fs/nfsd/pnfsd_lexp.c       |    3 +++
 include/linux/nfsd/pnfsd.h |    5 +++++
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index c64a346..66fe691 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1324,6 +1324,13 @@ __be32 nfsd4_create_session(struct svc_rqst *rqstp,
 	if (STALE_CLIENTID(&session->clientid))
 		return nfserr_stale_clientid;
 
+#if defined(CONFIG_PNFSD_LOCAL_EXPORT)
+	/* XXX hack to get local ip address */
+	memcpy(&pnfsd_lexp_addr, &rqstp->rq_xprt->xpt_local,
+		sizeof(pnfsd_lexp_addr));
+	pnfs_lexp_addr_len = rqstp->rq_xprt->xpt_locallen;
+#endif /* CONFIG_PNFSD_LOCAL_EXPORT */
+
 	nfs4_lock_state();
 	unconf = find_unconfirmed_client(&session->clientid);
 	conf = find_confirmed_client(&session->clientid);
diff --git a/fs/nfsd/pnfsd_lexp.c b/fs/nfsd/pnfsd_lexp.c
index 7cd4dd8..efcb19a 100644
--- a/fs/nfsd/pnfsd_lexp.c
+++ b/fs/nfsd/pnfsd_lexp.c
@@ -31,6 +31,9 @@
 
 #define NFSDDBG_FACILITY NFSDDBG_PNFS
 
+struct sockaddr pnfsd_lexp_addr;
+size_t pnfs_lexp_addr_len;
+
 static int
 pnfsd_lexp_layout_type(void)
 {
diff --git a/include/linux/nfsd/pnfsd.h b/include/linux/nfsd/pnfsd.h
index adc79ea..f2050bd 100644
--- a/include/linux/nfsd/pnfsd.h
+++ b/include/linux/nfsd/pnfsd.h
@@ -93,6 +93,11 @@ int nfs4_pnfs_get_layout(struct svc_fh *, struct pnfs_layoutget_arg *,
 int nfs4_pnfs_return_layout(struct super_block *, struct svc_fh *,
 					struct nfsd4_pnfs_layoutreturn *);
 
+#if defined(CONFIG_PNFSD_LOCAL_EXPORT)
+extern struct sockaddr pnfsd_lexp_addr;
+extern size_t pnfs_lexp_addr_len;
+#endif /* CONFIG_PNFSD_LOCAL_EXPORT */
+
 #endif /* CONFIG_PNFSD */
 
 #endif /* LINUX_NFSD_PNFSD_H */
-- 
1.5.3.3



More information about the pNFS mailing list