Skip to content

Commit 7f24e09

Browse files
Don BradyDelphix Engineering
Don Brady
authored and
Delphix Engineering
committed
DLPX-75524 avoid unnecessary nfserr_jukebox returns from nfsd_file_acquire (#8)
Upstream fix from kernel 5.12 nfsd: Don't keep looking up unhashed files in the nfsd file cache If a file is unhashed, then we're going to reject it anyway and retry, so make sure we skip it when we're doing the RCU lockless lookup. This avoids a number of unnecessary nfserr_jukebox returns from nfsd_file_acquire() Fixes: 65294c1 ("nfsd: add a new struct file caching facility to nfsd")
1 parent 6909b27 commit 7f24e09

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

fs/nfsd/filecache.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,8 @@ nfsd_file_find_locked(struct inode *inode, unsigned int may_flags,
751751
continue;
752752
if (!nfsd_match_cred(nf->nf_cred, current_cred()))
753753
continue;
754+
if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags))
755+
continue;
754756
if (nfsd_file_get(nf) != NULL)
755757
return nf;
756758
}
@@ -816,6 +818,9 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
816818
if (!new) {
817819
trace_nfsd_file_acquire(rqstp, hashval, inode, may_flags,
818820
NULL, nfserr_jukebox);
821+
pr_warn_ratelimited("nfsd: nfsd_file_acquire alloc failed XID, "
822+
"%08x, nfserr_jukebox\n",
823+
be32_to_cpu(rqstp->rq_xid));
819824
return nfserr_jukebox;
820825
}
821826

@@ -833,6 +838,10 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
833838
if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
834839
if (!retry) {
835840
status = nfserr_jukebox;
841+
pr_warn_ratelimited("nfsd: nfsd_file_acquire "
842+
"construction failed, XID %08x, "
843+
"nfserr_jukebox\n",
844+
be32_to_cpu(rqstp->rq_xid));
836845
goto out;
837846
}
838847
retry = false;
@@ -882,11 +891,15 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
882891
atomic_long_inc(&nfsd_filecache_count);
883892

884893
nf->nf_mark = nfsd_file_mark_find_or_create(nf);
885-
if (nf->nf_mark)
894+
if (nf->nf_mark) {
886895
status = nfsd_open_verified(rqstp, fhp, S_IFREG,
887896
may_flags, &nf->nf_file);
888-
else
897+
} else {
898+
pr_warn_ratelimited("nfsd: nfsd_file_acquire no file mark, XID "
899+
"%08x, nfserr_jukebox\n",
900+
be32_to_cpu(rqstp->rq_xid));
889901
status = nfserr_jukebox;
902+
}
890903
/*
891904
* If construction failed, or we raced with a call to unlink()
892905
* then unhash.

0 commit comments

Comments
 (0)