aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
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
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')
-rw-r--r--fs/nfs/nfs4_fs.h2
-rw-r--r--fs/nfs/nfs4proc.c13
-rw-r--r--fs/nfs/nfs4state.c34
3 files changed, 31 insertions, 18 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 50dd55069d3d..7e57b04e4014 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -225,6 +225,8 @@ extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp);
225extern int nfs4_proc_create_session(struct nfs_client *); 225extern int nfs4_proc_create_session(struct nfs_client *);
226extern int nfs4_proc_destroy_session(struct nfs4_session *); 226extern int nfs4_proc_destroy_session(struct nfs4_session *);
227extern int nfs4_init_session(struct nfs_server *server); 227extern int nfs4_init_session(struct nfs_server *server);
228extern int nfs4_proc_get_lease_time(struct nfs_client *clp,
229 struct nfs_fsinfo *fsinfo);
228#else /* CONFIG_NFS_v4_1 */ 230#else /* CONFIG_NFS_v4_1 */
229static inline int nfs4_setup_sequence(struct nfs_client *clp, 231static inline int nfs4_setup_sequence(struct nfs_client *clp,
230 struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, 232 struct nfs4_sequence_args *args, struct nfs4_sequence_res *res,
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index b4ef570eb53c..4be036942569 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4745,7 +4745,6 @@ int nfs4_proc_create_session(struct nfs_client *clp)
4745{ 4745{
4746 int status; 4746 int status;
4747 unsigned *ptr; 4747 unsigned *ptr;
4748 struct nfs_fsinfo fsinfo;
4749 struct nfs4_session *session = clp->cl_session; 4748 struct nfs4_session *session = clp->cl_session;
4750 4749
4751 dprintk("--> %s clp=%p session=%p\n", __func__, clp, session); 4750 dprintk("--> %s clp=%p session=%p\n", __func__, clp, session);
@@ -4767,18 +4766,6 @@ int nfs4_proc_create_session(struct nfs_client *clp)
4767 ptr = (unsigned *)&session->sess_id.data[0]; 4766 ptr = (unsigned *)&session->sess_id.data[0];
4768 dprintk("%s client>seqid %d sessionid %u:%u:%u:%u\n", __func__, 4767 dprintk("%s client>seqid %d sessionid %u:%u:%u:%u\n", __func__,
4769 clp->cl_seqid, ptr[0], ptr[1], ptr[2], ptr[3]); 4768 clp->cl_seqid, ptr[0], ptr[1], ptr[2], ptr[3]);
4770
4771 /* Get the lease time */
4772 status = nfs4_proc_get_lease_time(clp, &fsinfo);
4773 if (status == 0) {
4774 /* Update lease time and schedule renewal */
4775 spin_lock(&clp->cl_lock);
4776 clp->cl_lease_time = fsinfo.lease_time * HZ;
4777 clp->cl_last_renewal = jiffies;
4778 spin_unlock(&clp->cl_lock);
4779
4780 nfs4_schedule_state_renewal(clp);
4781 }
4782out: 4769out:
4783 dprintk("<-- %s\n", __func__); 4770 dprintk("<-- %s\n", __func__);
4784 return status; 4771 return status;
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