Skip to content

Commit e72f4d5

Browse files
Don BradyPrakash Surya
Don Brady
authored and
Prakash Surya
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 461e04a commit e72f4d5

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
@@ -958,6 +958,9 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
958958
if (!new) {
959959
trace_nfsd_file_acquire(rqstp, hashval, inode, may_flags,
960960
NULL, nfserr_jukebox);
961+
pr_warn_ratelimited("nfsd: nfsd_file_acquire alloc failed XID, "
962+
"%08x, nfserr_jukebox\n",
963+
be32_to_cpu(rqstp->rq_xid));
961964
return nfserr_jukebox;
962965
}
963966

@@ -975,6 +978,10 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
975978
if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
976979
if (!retry) {
977980
status = nfserr_jukebox;
981+
pr_warn_ratelimited("nfsd: nfsd_file_acquire "
982+
"construction failed, XID %08x, "
983+
"nfserr_jukebox\n",
984+
be32_to_cpu(rqstp->rq_xid));
978985
goto out;
979986
}
980987
retry = false;
@@ -1011,11 +1018,15 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
10111018
nfsd_file_gc();
10121019

10131020
nf->nf_mark = nfsd_file_mark_find_or_create(nf);
1014-
if (nf->nf_mark)
1021+
if (nf->nf_mark) {
10151022
status = nfsd_open_verified(rqstp, fhp, S_IFREG,
10161023
may_flags, &nf->nf_file);
1017-
else
1024+
} else {
1025+
pr_warn_ratelimited("nfsd: nfsd_file_acquire no file mark, XID "
1026+
"%08x, nfserr_jukebox\n",
1027+
be32_to_cpu(rqstp->rq_xid));
10181028
status = nfserr_jukebox;
1029+
}
10191030
/*
10201031
* If construction failed, or we raced with a call to unlink()
10211032
* then unhash.

0 commit comments

Comments
 (0)