提交 79d4e1f0 编写于 作者: C Chuck Lever 提交者: Trond Myklebust

NFS: Use proper naming conventions for NFSv4.1 server scope fields

Clean up:  When naming fields and data types, follow established
conventions to facilitate accurate grep/cscope searches.

Additionally, for consistency, move the scope field into the NFSv4-
specific part of the nfs_client, and free that memory in the logic
that shuts down NFSv4 nfs_clients.

Introduced by commit 99fe60d0 "nfs41: exchange_id operation", April
1 2009.
Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 722baafc
...@@ -237,6 +237,7 @@ static void nfs4_shutdown_client(struct nfs_client *clp) ...@@ -237,6 +237,7 @@ static void nfs4_shutdown_client(struct nfs_client *clp)
nfs_idmap_delete(clp); nfs_idmap_delete(clp);
rpc_destroy_wait_queue(&clp->cl_rpcwaitq); rpc_destroy_wait_queue(&clp->cl_rpcwaitq);
kfree(clp->cl_serverscope);
} }
/* idr_remove_all is not needed as all id's are removed by nfs_put_client */ /* idr_remove_all is not needed as all id's are removed by nfs_put_client */
...@@ -305,7 +306,6 @@ static void nfs_free_client(struct nfs_client *clp) ...@@ -305,7 +306,6 @@ static void nfs_free_client(struct nfs_client *clp)
put_net(clp->net); put_net(clp->net);
kfree(clp->cl_hostname); kfree(clp->cl_hostname);
kfree(clp->server_scope);
kfree(clp->impl_id); kfree(clp->impl_id);
kfree(clp); kfree(clp);
......
...@@ -338,7 +338,7 @@ extern void nfs4_schedule_stateid_recovery(const struct nfs_server *, struct nfs ...@@ -338,7 +338,7 @@ extern void nfs4_schedule_stateid_recovery(const struct nfs_server *, struct nfs
extern void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags); extern void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags);
extern void nfs41_handle_recall_slot(struct nfs_client *clp); extern void nfs41_handle_recall_slot(struct nfs_client *clp);
extern void nfs41_handle_server_scope(struct nfs_client *, extern void nfs41_handle_server_scope(struct nfs_client *,
struct server_scope **); struct nfs41_server_scope **);
extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp); extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp);
extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl); extern int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl);
extern void nfs4_select_rw_stateid(nfs4_stateid *, struct nfs4_state *, extern void nfs4_select_rw_stateid(nfs4_stateid *, struct nfs4_state *,
......
...@@ -5052,7 +5052,8 @@ static int nfs4_check_cl_exchange_flags(u32 flags) ...@@ -5052,7 +5052,8 @@ static int nfs4_check_cl_exchange_flags(u32 flags)
} }
static bool static bool
nfs41_same_server_scope(struct server_scope *a, struct server_scope *b) nfs41_same_server_scope(struct nfs41_server_scope *a,
struct nfs41_server_scope *b)
{ {
if (a->server_scope_sz == b->server_scope_sz && if (a->server_scope_sz == b->server_scope_sz &&
memcmp(a->server_scope, b->server_scope, a->server_scope_sz) == 0) memcmp(a->server_scope, b->server_scope, a->server_scope_sz) == 0)
...@@ -5099,7 +5100,8 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred) ...@@ -5099,7 +5100,8 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
clp->cl_rpcclient->cl_nodename, clp->cl_rpcclient->cl_nodename,
clp->cl_rpcclient->cl_auth->au_flavor); clp->cl_rpcclient->cl_auth->au_flavor);
res.server_scope = kzalloc(sizeof(struct server_scope), GFP_KERNEL); res.server_scope = kzalloc(sizeof(struct nfs41_server_scope),
GFP_KERNEL);
if (unlikely(!res.server_scope)) { if (unlikely(!res.server_scope)) {
status = -ENOMEM; status = -ENOMEM;
goto out; goto out;
...@@ -5123,18 +5125,18 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred) ...@@ -5123,18 +5125,18 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
kfree(res.impl_id); kfree(res.impl_id);
if (!status) { if (!status) {
if (clp->server_scope && if (clp->cl_serverscope &&
!nfs41_same_server_scope(clp->server_scope, !nfs41_same_server_scope(clp->cl_serverscope,
res.server_scope)) { res.server_scope)) {
dprintk("%s: server_scope mismatch detected\n", dprintk("%s: server_scope mismatch detected\n",
__func__); __func__);
set_bit(NFS4CLNT_SERVER_SCOPE_MISMATCH, &clp->cl_state); set_bit(NFS4CLNT_SERVER_SCOPE_MISMATCH, &clp->cl_state);
kfree(clp->server_scope); kfree(clp->cl_serverscope);
clp->server_scope = NULL; clp->cl_serverscope = NULL;
} }
if (!clp->server_scope) { if (!clp->cl_serverscope) {
clp->server_scope = res.server_scope; clp->cl_serverscope = res.server_scope;
goto out; goto out;
} }
} }
......
...@@ -17,7 +17,7 @@ struct nfs4_sequence_args; ...@@ -17,7 +17,7 @@ struct nfs4_sequence_args;
struct nfs4_sequence_res; struct nfs4_sequence_res;
struct nfs_server; struct nfs_server;
struct nfs4_minor_version_ops; struct nfs4_minor_version_ops;
struct server_scope; struct nfs41_server_scope;
struct nfs41_impl_id; struct nfs41_impl_id;
/* /*
...@@ -80,13 +80,13 @@ struct nfs_client { ...@@ -80,13 +80,13 @@ struct nfs_client {
/* The flags used for obtaining the clientid during EXCHANGE_ID */ /* The flags used for obtaining the clientid during EXCHANGE_ID */
u32 cl_exchange_flags; u32 cl_exchange_flags;
struct nfs4_session *cl_session; /* shared session */ struct nfs4_session *cl_session; /* shared session */
struct nfs41_server_scope *cl_serverscope;
#endif /* CONFIG_NFS_V4 */ #endif /* CONFIG_NFS_V4 */
#ifdef CONFIG_NFS_FSCACHE #ifdef CONFIG_NFS_FSCACHE
struct fscache_cookie *fscache; /* client index cache cookie */ struct fscache_cookie *fscache; /* client index cache cookie */
#endif #endif
struct server_scope *server_scope; /* from exchange_id */
struct nfs41_impl_id *impl_id; /* from exchange_id */ struct nfs41_impl_id *impl_id; /* from exchange_id */
struct net *net; struct net *net;
}; };
......
...@@ -1104,7 +1104,7 @@ struct server_owner { ...@@ -1104,7 +1104,7 @@ struct server_owner {
char major_id[NFS4_OPAQUE_LIMIT]; char major_id[NFS4_OPAQUE_LIMIT];
}; };
struct server_scope { struct nfs41_server_scope {
uint32_t server_scope_sz; uint32_t server_scope_sz;
char server_scope[NFS4_OPAQUE_LIMIT]; char server_scope[NFS4_OPAQUE_LIMIT];
}; };
...@@ -1118,7 +1118,7 @@ struct nfs41_impl_id { ...@@ -1118,7 +1118,7 @@ struct nfs41_impl_id {
struct nfs41_exchange_id_res { struct nfs41_exchange_id_res {
struct nfs_client *client; struct nfs_client *client;
u32 flags; u32 flags;
struct server_scope *server_scope; struct nfs41_server_scope *server_scope;
struct nfs41_impl_id *impl_id; struct nfs41_impl_id *impl_id;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册