diff options
author | Andy Adamson <andros@netapp.com> | 2009-04-01 09:22:47 -0400 |
---|---|---|
committer | Benny Halevy <bhalevy@panasas.com> | 2009-06-17 15:25:11 -0400 |
commit | 591d71cbde186cc498c0d9718dc17f2fadf7c643 (patch) | |
tree | 0cda78617611b2c3d3fb058af3cc0513ead80433 /fs/nfs/nfs4state.c | |
parent | a7b721037f898b29a8083da59b1dccd3da385b07 (diff) |
nfs41: establish sessions-based clientid
nfsv4.1 clientid is established via EXCHANGE_ID rather than
SETCLIENTID{,_CONFIRM}
This is implemented using a new establish_clid method in
nfs4_state_recovery_ops.
nfs41: establish clientid via exchange id only if cred != NULL
>From 2.6.26 reclaimer() uses machine cred for setting up the client id
therefore it is never expected to be NULL.
Signed-off-by: Rahul Iyer <iyer@netapp.com>
[removed dprintk]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfs41: lease renewal]
[revamped patch for new nfs4_state_manager design]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r-- | fs/nfs/nfs4state.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index da940abcfaa5..e17bd4412174 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -60,7 +60,7 @@ const nfs4_stateid zero_stateid; | |||
60 | 60 | ||
61 | static LIST_HEAD(nfs4_clientid_list); | 61 | static LIST_HEAD(nfs4_clientid_list); |
62 | 62 | ||
63 | static int nfs4_init_client(struct nfs_client *clp, struct rpc_cred *cred) | 63 | int nfs4_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) |
64 | { | 64 | { |
65 | unsigned short port; | 65 | unsigned short port; |
66 | int status; | 66 | int status; |
@@ -1098,11 +1098,13 @@ out: | |||
1098 | static int nfs4_reclaim_lease(struct nfs_client *clp) | 1098 | static int nfs4_reclaim_lease(struct nfs_client *clp) |
1099 | { | 1099 | { |
1100 | struct rpc_cred *cred; | 1100 | struct rpc_cred *cred; |
1101 | struct nfs4_state_recovery_ops *ops = | ||
1102 | nfs4_reboot_recovery_ops[clp->cl_minorversion]; | ||
1101 | int status = -ENOENT; | 1103 | int status = -ENOENT; |
1102 | 1104 | ||
1103 | cred = nfs4_get_setclientid_cred(clp); | 1105 | cred = nfs4_get_setclientid_cred(clp); |
1104 | if (cred != NULL) { | 1106 | if (cred != NULL) { |
1105 | status = nfs4_init_client(clp, cred); | 1107 | status = ops->establish_clid(clp, cred); |
1106 | put_rpccred(cred); | 1108 | put_rpccred(cred); |
1107 | /* Handle case where the user hasn't set up machine creds */ | 1109 | /* Handle case where the user hasn't set up machine creds */ |
1108 | if (status == -EACCES && cred == clp->cl_machine_cred) { | 1110 | if (status == -EACCES && cred == clp->cl_machine_cred) { |
@@ -1208,7 +1210,8 @@ static void nfs4_state_manager(struct nfs_client *clp) | |||
1208 | } | 1210 | } |
1209 | /* First recover reboot state... */ | 1211 | /* First recover reboot state... */ |
1210 | if (test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) { | 1212 | if (test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) { |
1211 | status = nfs4_do_reclaim(clp, &nfs4_reboot_recovery_ops); | 1213 | status = nfs4_do_reclaim(clp, |
1214 | nfs4_reboot_recovery_ops[clp->cl_minorversion]); | ||
1212 | if (status == -NFS4ERR_STALE_CLIENTID) | 1215 | if (status == -NFS4ERR_STALE_CLIENTID) |
1213 | continue; | 1216 | continue; |
1214 | if (test_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state)) | 1217 | if (test_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state)) |
@@ -1219,7 +1222,8 @@ static void nfs4_state_manager(struct nfs_client *clp) | |||
1219 | 1222 | ||
1220 | /* Now recover expired state... */ | 1223 | /* Now recover expired state... */ |
1221 | if (test_and_clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) { | 1224 | if (test_and_clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) { |
1222 | status = nfs4_do_reclaim(clp, &nfs4_nograce_recovery_ops); | 1225 | status = nfs4_do_reclaim(clp, |
1226 | nfs4_nograce_recovery_ops[clp->cl_minorversion]); | ||
1223 | if (status < 0) { | 1227 | if (status < 0) { |
1224 | set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state); | 1228 | set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state); |
1225 | if (status == -NFS4ERR_STALE_CLIENTID) | 1229 | if (status == -NFS4ERR_STALE_CLIENTID) |