46 #include <linux/nfs.h>
47 #include <linux/nfs4.h>
48 #include <linux/nfs_fs.h>
52 #define NFSDBG_FACILITY NFSDBG_STATE
57 const struct nfs4_state_maintenance_ops *
ops;
60 struct rpc_cred *
cred;
62 unsigned long last, now;
63 unsigned renew_flags = 0;
65 ops = clp->cl_mvops->state_renewal_ops;
66 dprintk(
"%s: start\n", __func__);
71 spin_lock(&clp->cl_lock);
72 lease = clp->cl_lease_time;
73 last = clp->cl_last_renewal;
77 renew_flags |= NFS4_RENEW_TIMEOUT;
79 renew_flags |= NFS4_RENEW_DELEGATION_CB;
81 if (renew_flags != 0) {
82 cred = ops->get_state_renewal_cred_locked(clp);
83 spin_unlock(&clp->cl_lock);
85 if (!(renew_flags & NFS4_RENEW_DELEGATION_CB)) {
86 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
92 ops->sched_state_renewal(clp, cred, renew_flags);
97 dprintk(
"%s: failed to call renewd. Reason: lease not expired \n",
99 spin_unlock(&clp->cl_lock);
105 dprintk(
"%s: done\n", __func__);
113 spin_lock(&clp->cl_lock);
114 timeout = (2 * clp->cl_lease_time) / 3 + (
long)clp->cl_last_renewal
116 if (timeout < 5 *
HZ)
118 dprintk(
"%s: requeueing work. Lease period = %ld\n",
119 __func__, (timeout +
HZ - 1) /
HZ);
122 spin_unlock(&clp->cl_lock);