]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
NFSv4: Keep dropped state owners on the LRU list for a while
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 21 Apr 2012 16:36:19 +0000 (12:36 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 21 Apr 2012 17:01:00 +0000 (13:01 -0400)
To ensure that we don't reuse their identifiers.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4state.c

index b300fb840b2165ee221f5599db2fa1860bad9ccc..7f0fcfc1fe9db51e9bc3748f511163dfed7cdce7 100644 (file)
@@ -521,6 +521,14 @@ out:
 /**
  * nfs4_put_state_owner - Release a nfs4_state_owner
  * @sp: state owner data to release
+ *
+ * Note that we keep released state owners on an LRU
+ * list.
+ * This caches valid state owners so that they can be
+ * reused, to avoid the OPEN_CONFIRM on minor version 0.
+ * It also pins the uniquifier of dropped state owners for
+ * a while, to ensure that those state owner names are
+ * never reused.
  */
 void nfs4_put_state_owner(struct nfs4_state_owner *sp)
 {
@@ -530,15 +538,9 @@ void nfs4_put_state_owner(struct nfs4_state_owner *sp)
        if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock))
                return;
 
-       if (!RB_EMPTY_NODE(&sp->so_server_node)) {
-               sp->so_expires = jiffies;
-               list_add_tail(&sp->so_lru, &server->state_owners_lru);
-               spin_unlock(&clp->cl_lock);
-       } else {
-               nfs4_remove_state_owner_locked(sp);
-               spin_unlock(&clp->cl_lock);
-               nfs4_free_state_owner(sp);
-       }
+       sp->so_expires = jiffies;
+       list_add_tail(&sp->so_lru, &server->state_owners_lru);
+       spin_unlock(&clp->cl_lock);
 }
 
 /**