OSDN Git Service

NFSv4: Ignore requests to return the delegation if it was revoked
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 22 Oct 2019 17:40:47 +0000 (13:40 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 4 Nov 2019 02:28:46 +0000 (21:28 -0500)
If the delegation was revoked, or is already being returned, just
clear the NFS_DELEGATION_RETURN and NFS_DELEGATION_RETURN_IF_CLOSED
flags and keep going.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/delegation.c

index 8c176c9..ebd83e4 100644 (file)
@@ -476,8 +476,6 @@ static bool nfs_delegation_need_return(struct nfs_delegation *delegation)
 {
        bool ret = false;
 
-       if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags))
-               goto out;
        if (test_and_clear_bit(NFS_DELEGATION_RETURN, &delegation->flags))
                ret = true;
        if (test_and_clear_bit(NFS_DELEGATION_RETURN_IF_CLOSED, &delegation->flags) && !ret) {
@@ -489,7 +487,10 @@ static bool nfs_delegation_need_return(struct nfs_delegation *delegation)
                        ret = true;
                spin_unlock(&delegation->lock);
        }
-out:
+       if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags) ||
+           test_bit(NFS_DELEGATION_REVOKED, &delegation->flags))
+               ret = false;
+
        return ret;
 }