Skip to content

Commit 7082950

Browse files
Don BradyDelphix Engineering
Don Brady
authored and
Delphix Engineering
committed
DLPX-75524 avoid unnecessary nfserr_jukebox returns from nfsd_file_acquire (#9)
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 1b6943d commit 7082950

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

fs/nfsd/filecache.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,9 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
818818
if (!new) {
819819
trace_nfsd_file_acquire(rqstp, hashval, inode, may_flags,
820820
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));
821824
return nfserr_jukebox;
822825
}
823826

@@ -835,6 +838,10 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
835838
if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
836839
if (!retry) {
837840
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));
838845
goto out;
839846
}
840847
retry = false;
@@ -884,11 +891,15 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
884891
atomic_long_inc(&nfsd_filecache_count);
885892

886893
nf->nf_mark = nfsd_file_mark_find_or_create(nf);
887-
if (nf->nf_mark)
894+
if (nf->nf_mark) {
888895
status = nfsd_open_verified(rqstp, fhp, S_IFREG,
889896
may_flags, &nf->nf_file);
890-
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));
891901
status = nfserr_jukebox;
902+
}
892903
/*
893904
* If construction failed, or we raced with a call to unlink()
894905
* then unhash.

0 commit comments

Comments
 (0)