]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/nfs/nfs4renewd.c
ocfs2: Field prefixes for the xattr_bucket structure
[linux-2.6-omap-h63xx.git] / fs / nfs / nfs4renewd.c
index 3305acbbe2ae3b7f4258baed8f5f807fbf7a1805..f524e932ff7b295f8bf0adce947f058f2d8ede73 100644 (file)
@@ -65,7 +65,6 @@ nfs4_renew_state(struct work_struct *work)
        long lease, timeout;
        unsigned long last, now;
 
-       down_read(&clp->cl_sem);
        dprintk("%s: start\n", __func__);
        /* Are there any active superblocks? */
        if (list_empty(&clp->cl_superblocks))
@@ -77,17 +76,19 @@ nfs4_renew_state(struct work_struct *work)
        timeout = (2 * lease) / 3 + (long)last - (long)now;
        /* Are we close to a lease timeout? */
        if (time_after(now, last + lease/3)) {
-               cred = nfs4_get_renew_cred(clp);
+               cred = nfs4_get_renew_cred_locked(clp);
+               spin_unlock(&clp->cl_lock);
                if (cred == NULL) {
-                       set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
-                       spin_unlock(&clp->cl_lock);
+                       if (list_empty(&clp->cl_delegations)) {
+                               set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
+                               goto out;
+                       }
                        nfs_expire_all_delegations(clp);
-                       goto out;
+               } else {
+                       /* Queue an asynchronous RENEW. */
+                       nfs4_proc_async_renew(clp, cred);
+                       put_rpccred(cred);
                }
-               spin_unlock(&clp->cl_lock);
-               /* Queue an asynchronous RENEW. */
-               nfs4_proc_async_renew(clp, cred);
-               put_rpccred(cred);
                timeout = (2 * lease) / 3;
                spin_lock(&clp->cl_lock);
        } else
@@ -100,12 +101,11 @@ nfs4_renew_state(struct work_struct *work)
        cancel_delayed_work(&clp->cl_renewd);
        schedule_delayed_work(&clp->cl_renewd, timeout);
        spin_unlock(&clp->cl_lock);
+       nfs_expire_unreferenced_delegations(clp);
 out:
-       up_read(&clp->cl_sem);
        dprintk("%s: done\n", __func__);
 }
 
-/* Must be called with clp->cl_sem locked for writes */
 void
 nfs4_schedule_state_renewal(struct nfs_client *clp)
 {