NFSv4: Clean up the process of renewing the NFSv4 lease
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
14516c3a30
commit
452e93523d
1 changed files with 9 additions and 14 deletions
|
@ -303,15 +303,19 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void renew_lease(const struct nfs_server *server, unsigned long timestamp)
|
static void do_renew_lease(struct nfs_client *clp, unsigned long timestamp)
|
||||||
{
|
{
|
||||||
struct nfs_client *clp = server->nfs_client;
|
|
||||||
spin_lock(&clp->cl_lock);
|
spin_lock(&clp->cl_lock);
|
||||||
if (time_before(clp->cl_last_renewal,timestamp))
|
if (time_before(clp->cl_last_renewal,timestamp))
|
||||||
clp->cl_last_renewal = timestamp;
|
clp->cl_last_renewal = timestamp;
|
||||||
spin_unlock(&clp->cl_lock);
|
spin_unlock(&clp->cl_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void renew_lease(const struct nfs_server *server, unsigned long timestamp)
|
||||||
|
{
|
||||||
|
do_renew_lease(server->nfs_client, timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_NFS_V4_1)
|
#if defined(CONFIG_NFS_V4_1)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -419,10 +423,7 @@ static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *
|
||||||
++slot->seq_nr;
|
++slot->seq_nr;
|
||||||
timestamp = res->sr_renewal_time;
|
timestamp = res->sr_renewal_time;
|
||||||
clp = res->sr_session->clp;
|
clp = res->sr_session->clp;
|
||||||
spin_lock(&clp->cl_lock);
|
do_renew_lease(clp, timestamp);
|
||||||
if (time_before(clp->cl_last_renewal, timestamp))
|
|
||||||
clp->cl_last_renewal = timestamp;
|
|
||||||
spin_unlock(&clp->cl_lock);
|
|
||||||
/* Check sequence flags */
|
/* Check sequence flags */
|
||||||
if (atomic_read(&clp->cl_count) > 1)
|
if (atomic_read(&clp->cl_count) > 1)
|
||||||
nfs41_handle_sequence_flag_errors(clp, res->sr_status_flags);
|
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)
|
||||||
nfs4_schedule_state_recovery(clp);
|
nfs4_schedule_state_recovery(clp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
spin_lock(&clp->cl_lock);
|
do_renew_lease(clp, timestamp);
|
||||||
if (time_before(clp->cl_last_renewal,timestamp))
|
|
||||||
clp->cl_last_renewal = timestamp;
|
|
||||||
spin_unlock(&clp->cl_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct rpc_call_ops nfs4_renew_ops = {
|
static const struct rpc_call_ops nfs4_renew_ops = {
|
||||||
|
@ -3263,10 +3261,7 @@ int nfs4_proc_renew(struct nfs_client *clp, struct rpc_cred *cred)
|
||||||
status = rpc_call_sync(clp->cl_rpcclient, &msg, 0);
|
status = rpc_call_sync(clp->cl_rpcclient, &msg, 0);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return status;
|
return status;
|
||||||
spin_lock(&clp->cl_lock);
|
do_renew_lease(clp, now);
|
||||||
if (time_before(clp->cl_last_renewal,now))
|
|
||||||
clp->cl_last_renewal = now;
|
|
||||||
spin_unlock(&clp->cl_lock);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue