Merge branch 'for-2.6.33' of git://linux-nfs.org/~bfields/linux
[safe/jmp/linux-2.6] / fs / nfs / nfs4renewd.c
index 6101f95..0156c01 100644 (file)
 void
 nfs4_renew_state(struct work_struct *work)
 {
+       struct nfs4_state_maintenance_ops *ops;
        struct nfs_client *clp =
                container_of(work, struct nfs_client, cl_renewd.work);
        struct rpc_cred *cred;
        long lease, timeout;
        unsigned long last, now;
 
+       ops = nfs4_state_renewal_ops[clp->cl_minorversion];
        dprintk("%s: start\n", __func__);
        /* Are there any active superblocks? */
        if (list_empty(&clp->cl_superblocks))
@@ -76,17 +78,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_locked(clp);
+               cred = ops->get_state_renewal_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. */
+                       ops->sched_state_renewal(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
@@ -99,6 +103,7 @@ 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:
        dprintk("%s: done\n", __func__);
 }
@@ -122,12 +127,6 @@ nfs4_schedule_state_renewal(struct nfs_client *clp)
 }
 
 void
-nfs4_renewd_prepare_shutdown(struct nfs_server *server)
-{
-       cancel_delayed_work(&server->nfs_client->cl_renewd);
-}
-
-void
 nfs4_kill_renewd(struct nfs_client *clp)
 {
        cancel_delayed_work_sync(&clp->cl_renewd);