media: admin-guide: add test-drivers
[linux-2.6-microblaze.git] / fs / nfs / nfs4state.c
index f7723d2..ac93715 100644 (file)
@@ -2524,6 +2524,21 @@ static int nfs4_bind_conn_to_session(struct nfs_client *clp)
        }
        return 0;
 }
+
+static void nfs4_layoutreturn_any_run(struct nfs_client *clp)
+{
+       int iomode = 0;
+
+       if (test_and_clear_bit(NFS4CLNT_RECALL_ANY_LAYOUT_READ, &clp->cl_state))
+               iomode += IOMODE_READ;
+       if (test_and_clear_bit(NFS4CLNT_RECALL_ANY_LAYOUT_RW, &clp->cl_state))
+               iomode += IOMODE_RW;
+       /* Note: IOMODE_READ + IOMODE_RW == IOMODE_ANY */
+       if (iomode) {
+               pnfs_layout_return_unused_byclid(clp, iomode);
+               set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
+       }
+}
 #else /* CONFIG_NFS_V4_1 */
 static int nfs4_reset_session(struct nfs_client *clp) { return 0; }
 
@@ -2531,6 +2546,10 @@ static int nfs4_bind_conn_to_session(struct nfs_client *clp)
 {
        return 0;
 }
+
+static void nfs4_layoutreturn_any_run(struct nfs_client *clp)
+{
+}
 #endif /* CONFIG_NFS_V4_1 */
 
 static void nfs4_state_manager(struct nfs_client *clp)
@@ -2635,12 +2654,13 @@ static void nfs4_state_manager(struct nfs_client *clp)
                nfs4_end_drain_session(clp);
                nfs4_clear_state_manager_bit(clp);
 
-               if (!test_and_set_bit(NFS4CLNT_DELEGRETURN_RUNNING, &clp->cl_state)) {
+               if (!test_and_set_bit(NFS4CLNT_RECALL_RUNNING, &clp->cl_state)) {
                        if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) {
                                nfs_client_return_marked_delegations(clp);
                                set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
                        }
-                       clear_bit(NFS4CLNT_DELEGRETURN_RUNNING, &clp->cl_state);
+                       nfs4_layoutreturn_any_run(clp);
+                       clear_bit(NFS4CLNT_RECALL_RUNNING, &clp->cl_state);
                }
 
                /* Did we race with an attempt to give us more work? */