Skip to content

Commit d92dcde

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 d8b5a8d commit d92dcde

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
@@ -966,6 +966,9 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
966966
if (!new) {
967967
trace_nfsd_file_acquire(rqstp, hashval, inode, may_flags,
968968
NULL, nfserr_jukebox);
969+
pr_warn_ratelimited("nfsd: nfsd_file_acquire alloc failed XID, "
970+
"%08x, nfserr_jukebox\n",
971+
be32_to_cpu(rqstp->rq_xid));
969972
return nfserr_jukebox;
970973
}
971974

@@ -983,6 +986,10 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
983986
if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
984987
if (!retry) {
985988
status = nfserr_jukebox;
989+
pr_warn_ratelimited("nfsd: nfsd_file_acquire "
990+
"construction failed, XID %08x, "
991+
"nfserr_jukebox\n",
992+
be32_to_cpu(rqstp->rq_xid));
986993
goto out;
987994
}
988995
retry = false;
@@ -1033,11 +1040,15 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
10331040
nfsd_file_gc();
10341041

10351042
nf->nf_mark = nfsd_file_mark_find_or_create(nf);
1036-
if (nf->nf_mark)
1043+
if (nf->nf_mark) {
10371044
status = nfsd_open_verified(rqstp, fhp, S_IFREG,
10381045
may_flags, &nf->nf_file);
1039-
else
1046+
} else {
1047+
pr_warn_ratelimited("nfsd: nfsd_file_acquire no file mark, XID "
1048+
"%08x, nfserr_jukebox\n",
1049+
be32_to_cpu(rqstp->rq_xid));
10401050
status = nfserr_jukebox;
1051+
}
10411052
/*
10421053
* If construction failed, or we raced with a call to unlink()
10431054
* then unhash.

0 commit comments

Comments
 (0)