diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-01-03 15:16:04 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-01-05 22:40:53 -0500 |
commit | ceb3a16c070c403f5f9ca46b46cf2bb79ea11750 (patch) | |
tree | 541de2598fad3fa145a94e119f70ab44edc2bf80 /fs | |
parent | 1fc0703af3143914a389bfa081c7acb09502ed5d (diff) |
NFSv4: Cache the NFSv4/v4.1 client owner_id in the struct nfs_client
Ensure that we cache the NFSv4/v4.1 client owner_id so that we can
verify it when we're doing trunking detection.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/nfs4client.c | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 19 |
2 files changed, 16 insertions, 4 deletions
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index d949d0f378ec..6ee9bf69a7a6 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c | |||
@@ -228,6 +228,7 @@ static void nfs4_shutdown_client(struct nfs_client *clp) | |||
228 | kfree(clp->cl_serverowner); | 228 | kfree(clp->cl_serverowner); |
229 | kfree(clp->cl_serverscope); | 229 | kfree(clp->cl_serverscope); |
230 | kfree(clp->cl_implid); | 230 | kfree(clp->cl_implid); |
231 | kfree(clp->cl_owner_id); | ||
231 | } | 232 | } |
232 | 233 | ||
233 | void nfs4_free_client(struct nfs_client *clp) | 234 | void nfs4_free_client(struct nfs_client *clp) |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index e7f8d5ff2581..1fab51682042 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -4917,11 +4917,14 @@ static void nfs4_init_boot_verifier(const struct nfs_client *clp, | |||
4917 | } | 4917 | } |
4918 | 4918 | ||
4919 | static unsigned int | 4919 | static unsigned int |
4920 | nfs4_init_nonuniform_client_string(const struct nfs_client *clp, | 4920 | nfs4_init_nonuniform_client_string(struct nfs_client *clp, |
4921 | char *buf, size_t len) | 4921 | char *buf, size_t len) |
4922 | { | 4922 | { |
4923 | unsigned int result; | 4923 | unsigned int result; |
4924 | 4924 | ||
4925 | if (clp->cl_owner_id != NULL) | ||
4926 | return strlcpy(buf, clp->cl_owner_id, len); | ||
4927 | |||
4925 | rcu_read_lock(); | 4928 | rcu_read_lock(); |
4926 | result = scnprintf(buf, len, "Linux NFSv4.0 %s/%s %s", | 4929 | result = scnprintf(buf, len, "Linux NFSv4.0 %s/%s %s", |
4927 | clp->cl_ipaddr, | 4930 | clp->cl_ipaddr, |
@@ -4930,24 +4933,32 @@ nfs4_init_nonuniform_client_string(const struct nfs_client *clp, | |||
4930 | rpc_peeraddr2str(clp->cl_rpcclient, | 4933 | rpc_peeraddr2str(clp->cl_rpcclient, |
4931 | RPC_DISPLAY_PROTO)); | 4934 | RPC_DISPLAY_PROTO)); |
4932 | rcu_read_unlock(); | 4935 | rcu_read_unlock(); |
4936 | clp->cl_owner_id = kstrdup(buf, GFP_KERNEL); | ||
4933 | return result; | 4937 | return result; |
4934 | } | 4938 | } |
4935 | 4939 | ||
4936 | static unsigned int | 4940 | static unsigned int |
4937 | nfs4_init_uniform_client_string(const struct nfs_client *clp, | 4941 | nfs4_init_uniform_client_string(struct nfs_client *clp, |
4938 | char *buf, size_t len) | 4942 | char *buf, size_t len) |
4939 | { | 4943 | { |
4940 | const char *nodename = clp->cl_rpcclient->cl_nodename; | 4944 | const char *nodename = clp->cl_rpcclient->cl_nodename; |
4945 | unsigned int result; | ||
4946 | |||
4947 | if (clp->cl_owner_id != NULL) | ||
4948 | return strlcpy(buf, clp->cl_owner_id, len); | ||
4941 | 4949 | ||
4942 | if (nfs4_client_id_uniquifier[0] != '\0') | 4950 | if (nfs4_client_id_uniquifier[0] != '\0') |
4943 | return scnprintf(buf, len, "Linux NFSv%u.%u %s/%s", | 4951 | result = scnprintf(buf, len, "Linux NFSv%u.%u %s/%s", |
4944 | clp->rpc_ops->version, | 4952 | clp->rpc_ops->version, |
4945 | clp->cl_minorversion, | 4953 | clp->cl_minorversion, |
4946 | nfs4_client_id_uniquifier, | 4954 | nfs4_client_id_uniquifier, |
4947 | nodename); | 4955 | nodename); |
4948 | return scnprintf(buf, len, "Linux NFSv%u.%u %s", | 4956 | else |
4957 | result = scnprintf(buf, len, "Linux NFSv%u.%u %s", | ||
4949 | clp->rpc_ops->version, clp->cl_minorversion, | 4958 | clp->rpc_ops->version, clp->cl_minorversion, |
4950 | nodename); | 4959 | nodename); |
4960 | clp->cl_owner_id = kstrdup(buf, GFP_KERNEL); | ||
4961 | return result; | ||
4951 | } | 4962 | } |
4952 | 4963 | ||
4953 | /* | 4964 | /* |