NFSv4.1 handle ERR_DELAY error reclaiming locking state on delegation recall
authorOlga Kornievskaia <kolga@netapp.com>
Thu, 20 Aug 2020 22:52:43 +0000 (18:52 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 27 Aug 2020 00:37:59 +0000 (20:37 -0400)
A client should be able to handle getting an ERR_DELAY error
while doing a LOCK call to reclaim state due to delegation being
recalled. This is a transient error that can happen due to server
moving its volumes and invalidating its file location cache and
upon reference to it during the LOCK call needing to do an
expensive lookup (leading to an ERR_DELAY error on a PUTFH).

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs4proc.c

index dbd01548335b2d034d90df3c4ea56ce4ae4dda64..4a6cfb497103a3de116b6efd7c3aff613612b7b7 100644 (file)
@@ -7298,7 +7298,12 @@ int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state,
        err = nfs4_set_lock_state(state, fl);
        if (err != 0)
                return err;
-       err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW);
+       do {
+               err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW);
+               if (err != -NFS4ERR_DELAY)
+                       break;
+               ssleep(1);
+       } while (err == -NFS4ERR_DELAY);
        return nfs4_handle_delegation_recall_error(server, state, stateid, fl, err);
 }