nfsd: Fix a write performance regression
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 31 Mar 2022 13:54:01 +0000 (09:54 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Thu, 31 Mar 2022 14:39:57 +0000 (10:39 -0400)
commit6b8a94332ee4f7d9a8ae0cbac7609f79c212f06c
treecbc91ab71ce43b7bf6a05a7da19bd634573a2233
parent5f7b839d47dbc74cf4a07beeab5191f93678673e
nfsd: Fix a write performance regression

The call to filemap_flush() in nfsd_file_put() is there to ensure that
we clear out any writes belonging to a NFSv3 client relatively quickly
and avoid situations where the file can't be evicted by the garbage
collector. It also ensures that we detect write errors quickly.

The problem is this causes a regression in performance for some
workloads.

So try to improve matters by deferring writeback until we're ready to
close the file, and need to detect errors so that we can force the
client to resend.

Tested-by: Jan Kara <jack@suse.cz>
Fixes: b6669305d35a ("nfsd: Reduce the number of calls to nfsd_file_gc()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Link: https://lore.kernel.org/all/20220330103457.r4xrhy2d6nhtouzk@quack3.lan
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/filecache.c