summaryrefslogtreecommitdiffstats
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 ef9622e500e..9cfe6864d9e 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)
#if defined(CONFIG_NFS_V4_1)
+static int nfs41_setup_state_renewal(struct nfs_client *clp)
+{
+ int status;
+ struct nfs_fsinfo fsinfo;
+
+ status = nfs4_proc_get_lease_time(clp, &fsinfo);
+ if (status == 0) {
+ /* Update lease time and schedule renewal */
+ spin_lock(&clp->cl_lock);
+ clp->cl_lease_time = fsinfo.lease_time * HZ;
+ clp->cl_last_renewal = jiffies;
+ spin_unlock(&clp->cl_lock);
+
+ nfs4_schedule_state_renewal(clp);
+ }
+
+ return status;
+}
+
int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred)
{
int status;
status = nfs4_proc_exchange_id(clp, cred);
- if (status == 0)
- /* create session schedules state renewal upon success */
- status = nfs4_proc_create_session(clp);
- if (status == 0)
- nfs_mark_client_ready(clp, NFS_CS_READY);
+ if (status != 0)
+ goto out;
+ status = nfs4_proc_create_session(clp);
+ if (status != 0)
+ goto out;
+ nfs41_setup_state_renewal(clp);
+ nfs_mark_client_ready(clp, NFS_CS_READY);
+out:
return status;
}
@@ -1248,6 +1270,8 @@ out:
/* Wake up the next rpc task even on error */
clear_bit(NFS4CLNT_SESSION_DRAINING, &clp->cl_state);
rpc_wake_up(&clp->cl_session->fc_slot_table.slot_tbl_waitq);
+ if (status == 0)
+ nfs41_setup_state_renewal(clp);
return status;
}