Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfsd: fix filecache lookup

If the lookup keeps finding a nfsd_file with an unhashed open file,
then retry once only.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: stable@vger.kernel.org
Fixes: 65294c1f2c5e "nfsd: add a new struct file caching facility to nfsd"
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

authored by

Trond Myklebust and committed by
J. Bruce Fields
28c7d86b e44b4bf2

+6
+6
fs/nfsd/filecache.c
··· 789 789 struct nfsd_file *nf, *new; 790 790 struct inode *inode; 791 791 unsigned int hashval; 792 + bool retry = true; 792 793 793 794 /* FIXME: skip this if fh_dentry is already set? */ 794 795 status = fh_verify(rqstp, fhp, S_IFREG, ··· 825 824 826 825 /* Did construction of this file fail? */ 827 826 if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) { 827 + if (!retry) { 828 + status = nfserr_jukebox; 829 + goto out; 830 + } 831 + retry = false; 828 832 nfsd_file_put_noref(nf); 829 833 goto retry; 830 834 }