Skip to content

Commit a07bb77

Browse files
Don Bradypzakha
Don Brady
authored andcommitted
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 6eb016b commit a07bb77

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
@@ -816,6 +816,9 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
816816
if (!new) {
817817
trace_nfsd_file_acquire(rqstp, hashval, inode, may_flags,
818818
NULL, nfserr_jukebox);
819+
pr_warn_ratelimited("nfsd: nfsd_file_acquire alloc failed XID, "
820+
"%08x, nfserr_jukebox\n",
821+
be32_to_cpu(rqstp->rq_xid));
819822
return nfserr_jukebox;
820823
}
821824

@@ -833,6 +836,10 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
833836
if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
834837
if (!retry) {
835838
status = nfserr_jukebox;
839+
pr_warn_ratelimited("nfsd: nfsd_file_acquire "
840+
"construction failed, XID %08x, "
841+
"nfserr_jukebox\n",
842+
be32_to_cpu(rqstp->rq_xid));
836843
goto out;
837844
}
838845
retry = false;
@@ -882,11 +889,15 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
882889
atomic_long_inc(&nfsd_filecache_count);
883890

884891
nf->nf_mark = nfsd_file_mark_find_or_create(nf);
885-
if (nf->nf_mark)
892+
if (nf->nf_mark) {
886893
status = nfsd_open_verified(rqstp, fhp, S_IFREG,
887894
may_flags, &nf->nf_file);
888-
else
895+
} else {
896+
pr_warn_ratelimited("nfsd: nfsd_file_acquire no file mark, XID "
897+
"%08x, nfserr_jukebox\n",
898+
be32_to_cpu(rqstp->rq_xid));
889899
status = nfserr_jukebox;
900+
}
890901
/*
891902
* If construction failed, or we raced with a call to unlink()
892903
* then unhash.

0 commit comments

Comments
 (0)