]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nfsd: fix filecache lookup
authorTrond Myklebust <trondmy@gmail.com>
Mon, 6 Jan 2020 18:18:03 +0000 (13:18 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 22 Jan 2020 21:25:01 +0000 (16:25 -0500)
If the lookup keeps finding a nfsd_file with an unhashed open file,
then retry once only.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: stable@vger.kernel.org
Fixes: a773ac40fe37 "nfsd: add a new struct file caching facility to nfsd"
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/filecache.c

index 32a9bf22ac08d837f548b25a49363c7faf91f5ff..0a3e5c2aac4b4f60d65ced5fad072c2395f4b5a4 100644 (file)
@@ -789,6 +789,7 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
        struct nfsd_file *nf, *new;
        struct inode *inode;
        unsigned int hashval;
+       bool retry = true;
 
        /* FIXME: skip this if fh_dentry is already set? */
        status = fh_verify(rqstp, fhp, S_IFREG,
@@ -824,6 +825,11 @@ wait_for_construction:
 
        /* Did construction of this file fail? */
        if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
+               if (!retry) {
+                       status = nfserr_jukebox;
+                       goto out;
+               }
+               retry = false;
                nfsd_file_put_noref(nf);
                goto retry;
        }