2020-01-06 18:20:45

by Trond Myklebust

[permalink] [raw]
Subject: [PATCH RESEND 0/6] Improve performance of containerised knfsd

The following patches fix up the garbage collection for the knfsd file
cache, to make the behaviour under load be more predictable.
It also separates out the garbage collectors for knfsd instances running
under different containers to ensure that a close() or fput() of a file
in one container that hangs or is slow won't gum up the system for
all the other containers.

Trond Myklebust (6):
nfsd: fix filecache lookup
nfsd: cleanup nfsd_file_lru_dispose()
nfsd: Containerise filecache laundrette
nfsd: Remove unused constant NFSD_FILE_LRU_RESCAN
nfsd: Schedule the laundrette regularly irrespective of file errors
nfsd: Reduce the number of calls to nfsd_file_gc()

fs/nfsd/filecache.c | 285 ++++++++++++++++++++++++++++++++++----------
fs/nfsd/filecache.h | 2 +
fs/nfsd/nfssvc.c | 9 +-
3 files changed, 230 insertions(+), 66 deletions(-)

--
2.24.1


2020-01-06 18:20:45

by Trond Myklebust

[permalink] [raw]
Subject: [PATCH RESEND 1/6] 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 <[email protected]>
---
fs/nfsd/filecache.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index 32a9bf22ac08..0a3e5c2aac4b 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -789,6 +789,7 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
struct nfsd_file *nf, *new;
struct inode *inode;
unsigned int hashval;
+ bool retry = true;

/* FIXME: skip this if fh_dentry is already set? */
status = fh_verify(rqstp, fhp, S_IFREG,
@@ -824,6 +825,11 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,

/* Did construction of this file fail? */
if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
+ if (!retry) {
+ status = nfserr_jukebox;
+ goto out;
+ }
+ retry = false;
nfsd_file_put_noref(nf);
goto retry;
}
--
2.24.1

2020-01-21 21:30:14

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH RESEND 1/6] nfsd: fix filecache lookup

On Mon, Jan 06, 2020 at 01:18:03PM -0500, Trond Myklebust wrote:
> If the lookup keeps finding a nfsd_file with an unhashed open file,
> then retry once only.

So, symptoms are a hang?

Should this be cc: stable, Fixes: 65294c1f2c5e ("nfsd: add a new struct
file caching facility to nfsd") ?

--b.

>
> Signed-off-by: Trond Myklebust <[email protected]>
> ---
> fs/nfsd/filecache.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
> index 32a9bf22ac08..0a3e5c2aac4b 100644
> --- a/fs/nfsd/filecache.c
> +++ b/fs/nfsd/filecache.c
> @@ -789,6 +789,7 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
> struct nfsd_file *nf, *new;
> struct inode *inode;
> unsigned int hashval;
> + bool retry = true;
>
> /* FIXME: skip this if fh_dentry is already set? */
> status = fh_verify(rqstp, fhp, S_IFREG,
> @@ -824,6 +825,11 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
>
> /* Did construction of this file fail? */
> if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
> + if (!retry) {
> + status = nfserr_jukebox;
> + goto out;
> + }
> + retry = false;
> nfsd_file_put_noref(nf);
> goto retry;
> }
> --
> 2.24.1

2020-01-21 23:07:40

by Trond Myklebust

[permalink] [raw]
Subject: Re: [PATCH RESEND 1/6] nfsd: fix filecache lookup

On Tue, 2020-01-21 at 16:28 -0500, J. Bruce Fields wrote:
> On Mon, Jan 06, 2020 at 01:18:03PM -0500, Trond Myklebust wrote:
> > If the lookup keeps finding a nfsd_file with an unhashed open file,
> > then retry once only.
>
> So, symptoms are a hang?
>
> Should this be cc: stable, Fixes: 65294c1f2c5e ("nfsd: add a new
> struct
> file caching facility to nfsd") ?

I would recommend that we make it a stable fix, yes. We've hit it
internally, and I believe Chuck was hitting it as well.


--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]