aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-07-31 14:29:06 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-08-03 22:06:42 -0400
commit452e93523d9433f83670e7b42cbe75319c208762 (patch)
tree343d79e89bb89db7152ff5e1c292ecf5b90d15bc /fs
parent14516c3a30e256e8d4e7a9af271c8df644ac3222 (diff)
NFSv4: Clean up the process of renewing the NFSv4 lease
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4proc.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index cab0eb915145..d2d20fbeb086 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -303,15 +303,19 @@ do_state_recovery:
303} 303}
304 304
305 305
306static void renew_lease(const struct nfs_server *server, unsigned long timestamp) 306static void do_renew_lease(struct nfs_client *clp, unsigned long timestamp)
307{ 307{
308 struct nfs_client *clp = server->nfs_client;
309 spin_lock(&clp->cl_lock); 308 spin_lock(&clp->cl_lock);
310 if (time_before(clp->cl_last_renewal,timestamp)) 309 if (time_before(clp->cl_last_renewal,timestamp))
311 clp->cl_last_renewal = timestamp; 310 clp->cl_last_renewal = timestamp;
312 spin_unlock(&clp->cl_lock); 311 spin_unlock(&clp->cl_lock);
313} 312}
314 313
314static void renew_lease(const struct nfs_server *server, unsigned long timestamp)
315{
316 do_renew_lease(server->nfs_client, timestamp);
317}
318
315#if defined(CONFIG_NFS_V4_1) 319#if defined(CONFIG_NFS_V4_1)
316 320
317/* 321/*
@@ -419,10 +423,7 @@ static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *
419 ++slot->seq_nr; 423 ++slot->seq_nr;
420 timestamp = res->sr_renewal_time; 424 timestamp = res->sr_renewal_time;
421 clp = res->sr_session->clp; 425 clp = res->sr_session->clp;
422 spin_lock(&clp->cl_lock); 426 do_renew_lease(clp, timestamp);
423 if (time_before(clp->cl_last_renewal, timestamp))
424 clp->cl_last_renewal = timestamp;
425 spin_unlock(&clp->cl_lock);
426 /* Check sequence flags */ 427 /* Check sequence flags */
427 if (atomic_read(&clp->cl_count) > 1) 428 if (atomic_read(&clp->cl_count) > 1)
428 nfs41_handle_sequence_flag_errors(clp, res->sr_status_flags); 429 nfs41_handle_sequence_flag_errors(clp, res->sr_status_flags);
@@ -3219,10 +3220,7 @@ static void nfs4_renew_done(struct rpc_task *task, void *calldata)
3219 nfs4_schedule_state_recovery(clp); 3220 nfs4_schedule_state_recovery(clp);
3220 return; 3221 return;
3221 } 3222 }
3222 spin_lock(&clp->cl_lock); 3223 do_renew_lease(clp, timestamp);
3223 if (time_before(clp->cl_last_renewal,timestamp))
3224 clp->cl_last_renewal = timestamp;
3225 spin_unlock(&clp->cl_lock);
3226} 3224}
3227 3225
3228static const struct rpc_call_ops nfs4_renew_ops = { 3226static const struct rpc_call_ops nfs4_renew_ops = {
@@ -3263,10 +3261,7 @@ int nfs4_proc_renew(struct nfs_client *clp, struct rpc_cred *cred)
3263 status = rpc_call_sync(clp->cl_rpcclient, &msg, 0); 3261 status = rpc_call_sync(clp->cl_rpcclient, &msg, 0);
3264 if (status < 0) 3262 if (status < 0)
3265 return status; 3263 return status;
3266 spin_lock(&clp->cl_lock); 3264 do_renew_lease(clp, now);
3267 if (time_before(clp->cl_last_renewal,now))
3268 clp->cl_last_renewal = now;
3269 spin_unlock(&clp->cl_lock);
3270 return 0; 3265 return 0;
3271} 3266}
3272 3267