NFSv4.1: Allow SEQUENCE to resize the slot table on the fly
[firefly-linux-kernel-4.4.55.git] / fs / nfs / nfs4state.c
index 1b7fa73c9436c95b1563b4480d2d54c3f62f5de4..c14b2c7ac8a787c1cca1ed6e96b0e7565d633269 100644 (file)
@@ -2025,29 +2025,15 @@ out:
 static int nfs4_recall_slot(struct nfs_client *clp)
 {
        struct nfs4_slot_table *fc_tbl;
-       struct nfs4_slot *new, *old;
-       int i;
+       u32 new_size;
 
        if (!nfs4_has_session(clp))
                return 0;
        nfs4_begin_drain_session(clp);
-       fc_tbl = &clp->cl_session->fc_slot_table;
-       new = nfs4_alloc_slots(fc_tbl, fc_tbl->target_highest_slotid + 1, GFP_NOFS);
-        if (!new)
-               return -ENOMEM;
 
-       spin_lock(&fc_tbl->slot_tbl_lock);
-       for (i = 0; i <= fc_tbl->target_highest_slotid; i++)
-               new[i].seq_nr = fc_tbl->slots[i].seq_nr;
-       old = fc_tbl->slots;
-       fc_tbl->slots = new;
-       fc_tbl->max_slots = fc_tbl->target_highest_slotid + 1;
-       fc_tbl->max_slotid = fc_tbl->target_highest_slotid;
-       clp->cl_session->fc_attrs.max_reqs = fc_tbl->max_slots;
-       spin_unlock(&fc_tbl->slot_tbl_lock);
-
-       kfree(old);
-       return 0;
+       fc_tbl = &clp->cl_session->fc_slot_table;
+       new_size = fc_tbl->server_highest_slotid + 1;
+       return nfs4_resize_slot_table(fc_tbl, new_size, 1);
 }
 
 static int nfs4_bind_conn_to_session(struct nfs_client *clp)