nfs: cache all open LOCALIO nfsd_file(s) in client
authorMike Snitzer <snitzer@kernel.org>
Sat, 16 Nov 2024 01:40:57 +0000 (20:40 -0500)
committerAnna Schumaker <anna.schumaker@oracle.com>
Tue, 14 Jan 2025 22:04:05 +0000 (17:04 -0500)
commit86e00412254a717ffd5d38dc5ec0ee1cce6281b3
tree4410af903885dba544f8253eb203a34a4b91cd44
parent4ee7ba40007357a48447a8cbc667480acf9a006a
nfs: cache all open LOCALIO nfsd_file(s) in client

This commit switches from leaning heavily on NFSD's filecache (in
terms of GC'd nfsd_files) back to caching nfsd_files in the
client. A later commit will add the callback mechanism needed to
allow NFSD to force the NFS client to cleanup all cached nfsd_files.

Add nfs_fh_localio_init() and 'struct nfs_fh_localio' to cache opened
nfsd_file(s) (both a RO and RW nfsd_file is able to be opened and
cached for a given nfs_fh).

Update nfs_local_open_fh() to cache the nfsd_file once it is opened
using __nfs_local_open_fh().

Introduce nfs_close_local_fh() to clear the cached open nfsd_files and
call nfs_to_nfsd_file_put_local().

Refcounting is such that:
- nfs_local_open_fh() is paired with nfs_close_local_fh().
- __nfs_local_open_fh() is paired with nfs_to_nfsd_file_put_local().
- nfs_local_file_get() is paired with nfs_local_file_put().

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/flexfilelayout/flexfilelayout.h
fs/nfs/inode.c
fs/nfs/internal.h
fs/nfs/localio.c
fs/nfs/pagelist.c
fs/nfs/write.c
fs/nfs_common/nfslocalio.c
include/linux/nfs_fs.h
include/linux/nfslocalio.h