aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
authorRicardo Labiaga <Ricardo.Labiaga@netapp.com>2009-12-06 12:23:46 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-12-06 12:23:46 -0500
commit9430fb6b5315f7bc94b05be915c64ebfefc55bbc (patch)
treebdd930aef91eb7ef954a51919ee2fecae8044e01 /fs/nfs/nfs4state.c
parentbcb56164ceb21317208eee89c829580d51b84a6d (diff)
nfs41: nfs41_setup_state_renewal
Move call to get the lease time and the setup of the state renewal out of nfs4_create_session so that it can be called after clearing the DRAINING flag. We use the getattr RPC to obtain the lease time, which requires a sequence slot. Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index ef9622e500e4..9cfe6864d9ed 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -116,16 +116,38 @@ struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp)
116 116
117#if defined(CONFIG_NFS_V4_1) 117#if defined(CONFIG_NFS_V4_1)
118 118
119static int nfs41_setup_state_renewal(struct nfs_client *clp)
120{
121 int status;
122 struct nfs_fsinfo fsinfo;
123
124 status = nfs4_proc_get_lease_time(clp, &fsinfo);
125 if (status == 0) {
126 /* Update lease time and schedule renewal */
127 spin_lock(&clp->cl_lock);
128 clp->cl_lease_time = fsinfo.lease_time * HZ;
129 clp->cl_last_renewal = jiffies;
130 spin_unlock(&clp->cl_lock);
131
132 nfs4_schedule_state_renewal(clp);
133 }
134
135 return status;
136}
137
119int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) 138int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred)
120{ 139{
121 int status; 140 int status;
122 141
123 status = nfs4_proc_exchange_id(clp, cred); 142 status = nfs4_proc_exchange_id(clp, cred);
124 if (status == 0) 143 if (status != 0)
125 /* create session schedules state renewal upon success */ 144 goto out;
126 status = nfs4_proc_create_session(clp); 145 status = nfs4_proc_create_session(clp);
127 if (status == 0) 146 if (status != 0)
128 nfs_mark_client_ready(clp, NFS_CS_READY); 147 goto out;
148 nfs41_setup_state_renewal(clp);
149 nfs_mark_client_ready(clp, NFS_CS_READY);
150out:
129 return status; 151 return status;
130} 152}
131 153
@@ -1248,6 +1270,8 @@ out:
1248 /* Wake up the next rpc task even on error */ 1270 /* Wake up the next rpc task even on error */
1249 clear_bit(NFS4CLNT_SESSION_DRAINING, &clp->cl_state); 1271 clear_bit(NFS4CLNT_SESSION_DRAINING, &clp->cl_state);
1250 rpc_wake_up(&clp->cl_session->fc_slot_table.slot_tbl_waitq); 1272 rpc_wake_up(&clp->cl_session->fc_slot_table.slot_tbl_waitq);
1273 if (status == 0)
1274 nfs41_setup_state_renewal(clp);
1251 return status; 1275 return status;
1252} 1276}
1253 1277