aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4renewd.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4renewd.c')
-rw-r--r--fs/nfs/nfs4renewd.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c
index a3001628ad32..5d764d8e6d8a 100644
--- a/fs/nfs/nfs4renewd.c
+++ b/fs/nfs/nfs4renewd.c
@@ -54,6 +54,7 @@
54#include <linux/nfs4.h> 54#include <linux/nfs4.h>
55#include <linux/nfs_fs.h> 55#include <linux/nfs_fs.h>
56#include "nfs4_fs.h" 56#include "nfs4_fs.h"
57#include "delegation.h"
57 58
58#define NFSDBG_FACILITY NFSDBG_PROC 59#define NFSDBG_FACILITY NFSDBG_PROC
59 60
@@ -61,6 +62,7 @@ void
61nfs4_renew_state(void *data) 62nfs4_renew_state(void *data)
62{ 63{
63 struct nfs4_client *clp = (struct nfs4_client *)data; 64 struct nfs4_client *clp = (struct nfs4_client *)data;
65 struct rpc_cred *cred;
64 long lease, timeout; 66 long lease, timeout;
65 unsigned long last, now; 67 unsigned long last, now;
66 68
@@ -68,7 +70,7 @@ nfs4_renew_state(void *data)
68 dprintk("%s: start\n", __FUNCTION__); 70 dprintk("%s: start\n", __FUNCTION__);
69 /* Are there any active superblocks? */ 71 /* Are there any active superblocks? */
70 if (list_empty(&clp->cl_superblocks)) 72 if (list_empty(&clp->cl_superblocks))
71 goto out; 73 goto out;
72 spin_lock(&clp->cl_lock); 74 spin_lock(&clp->cl_lock);
73 lease = clp->cl_lease_time; 75 lease = clp->cl_lease_time;
74 last = clp->cl_last_renewal; 76 last = clp->cl_last_renewal;
@@ -76,9 +78,17 @@ nfs4_renew_state(void *data)
76 timeout = (2 * lease) / 3 + (long)last - (long)now; 78 timeout = (2 * lease) / 3 + (long)last - (long)now;
77 /* Are we close to a lease timeout? */ 79 /* Are we close to a lease timeout? */
78 if (time_after(now, last + lease/3)) { 80 if (time_after(now, last + lease/3)) {
81 cred = nfs4_get_renew_cred(clp);
82 if (cred == NULL) {
83 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
84 spin_unlock(&clp->cl_lock);
85 nfs_expire_all_delegations(clp);
86 goto out;
87 }
79 spin_unlock(&clp->cl_lock); 88 spin_unlock(&clp->cl_lock);
80 /* Queue an asynchronous RENEW. */ 89 /* Queue an asynchronous RENEW. */
81 nfs4_proc_async_renew(clp); 90 nfs4_proc_async_renew(clp, cred);
91 put_rpccred(cred);
82 timeout = (2 * lease) / 3; 92 timeout = (2 * lease) / 3;
83 spin_lock(&clp->cl_lock); 93 spin_lock(&clp->cl_lock);
84 } else 94 } else