All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nfsv4: set hostname when creating nfsv4 ds connection
@ 2014-07-08  3:45 Peng Tao
  2014-07-08  3:45 ` [PATCH 2/2] nfs: check hostname in nfs_get_client Peng Tao
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Tao @ 2014-07-08  3:45 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs, Peng Tao

We reference cl_hostname in many places for debugging purpose.
So make it useful by setting hostname when calling nfs_get_client.

Signed-off-by: Peng Tao <tao.peng@primarydata.com>
---
 fs/nfs/nfs4client.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index 9940037..ff8cba2 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -856,6 +856,11 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
 	};
 	struct rpc_timeout ds_timeout;
 	struct nfs_client *clp;
+	char buf[INET6_ADDRSTRLEN + 1];
+
+	if (rpc_ntop(ds_addr, buf, sizeof(buf)) <= 0)
+		return ERR_PTR(-EINVAL);
+	cl_init.hostname = buf;
 
 	/*
 	 * Set an authflavor equual to the MDS value. Use the MDS nfs_client
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] nfs: check hostname in nfs_get_client
  2014-07-08  3:45 [PATCH 1/2] nfsv4: set hostname when creating nfsv4 ds connection Peng Tao
@ 2014-07-08  3:45 ` Peng Tao
  0 siblings, 0 replies; 2+ messages in thread
From: Peng Tao @ 2014-07-08  3:45 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs, Peng Tao

We reference cl_hostname in many places. Add a check to make
sure it exists.

Signed-off-by: Peng Tao <tao.peng@primarydata.com>
---
 fs/nfs/client.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 1d09289..b213ee8 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -482,8 +482,13 @@ nfs_get_client(const struct nfs_client_initdata *cl_init,
 	struct nfs_net *nn = net_generic(cl_init->net, nfs_net_id);
 	const struct nfs_rpc_ops *rpc_ops = cl_init->nfs_mod->rpc_ops;
 
+	if (cl_init->hostname == NULL) {
+		WARN_ON(1);
+		return NULL;
+	}
+
 	dprintk("--> nfs_get_client(%s,v%u)\n",
-		cl_init->hostname ?: "", rpc_ops->version);
+		cl_init->hostname, rpc_ops->version);
 
 	/* see if the client already exists */
 	do {
@@ -510,7 +515,7 @@ nfs_get_client(const struct nfs_client_initdata *cl_init,
 	} while (!IS_ERR(new));
 
 	dprintk("<-- nfs_get_client() Failed to find %s (%ld)\n",
-		cl_init->hostname ?: "", PTR_ERR(new));
+		cl_init->hostname, PTR_ERR(new));
 	return new;
 }
 EXPORT_SYMBOL_GPL(nfs_get_client);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-08  3:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-08  3:45 [PATCH 1/2] nfsv4: set hostname when creating nfsv4 ds connection Peng Tao
2014-07-08  3:45 ` [PATCH 2/2] nfs: check hostname in nfs_get_client Peng Tao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.