Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nfsd: Don't keep looking up unhashed files in the nfsd file cache #8

Merged
merged 1 commit into from
May 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions fs/nfsd/filecache.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,8 @@ nfsd_file_find_locked(struct inode *inode, unsigned int may_flags,
continue;
if (!nfsd_match_cred(nf->nf_cred, current_cred()))
continue;
if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags))
continue;
if (nfsd_file_get(nf) != NULL)
return nf;
}
Expand Down Expand Up @@ -816,6 +818,9 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
if (!new) {
trace_nfsd_file_acquire(rqstp, hashval, inode, may_flags,
NULL, nfserr_jukebox);
pr_warn_ratelimited("nfsd: nfsd_file_acquire alloc failed XID, "
"%08x, nfserr_jukebox\n",
be32_to_cpu(rqstp->rq_xid));
return nfserr_jukebox;
}

Expand All @@ -833,6 +838,10 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
if (!retry) {
status = nfserr_jukebox;
pr_warn_ratelimited("nfsd: nfsd_file_acquire "
"construction failed, XID %08x, "
"nfserr_jukebox\n",
be32_to_cpu(rqstp->rq_xid));
goto out;
}
retry = false;
Expand Down Expand Up @@ -882,11 +891,15 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
atomic_long_inc(&nfsd_filecache_count);

nf->nf_mark = nfsd_file_mark_find_or_create(nf);
if (nf->nf_mark)
if (nf->nf_mark) {
status = nfsd_open_verified(rqstp, fhp, S_IFREG,
may_flags, &nf->nf_file);
else
} else {
pr_warn_ratelimited("nfsd: nfsd_file_acquire no file mark, XID "
"%08x, nfserr_jukebox\n",
be32_to_cpu(rqstp->rq_xid));
status = nfserr_jukebox;
}
/*
* If construction failed, or we raced with a call to unlink()
* then unhash.
Expand Down