]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFSD: Revert "NFSD: NFSv4 CLOSE should release an nfsd_file immediately"
authorChuck Lever <chuck.lever@oracle.com>
Fri, 28 Oct 2022 14:46:44 +0000 (10:46 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:58:25 +0000 (11:58 +0100)
[ Upstream commit dcf3f80965ca787c70def402cdf1553c93c75529 ]

This reverts commit a08f29b107d0f9a2165ebdee1b9ee033dc88395a.

That commit attempted to make files available to other users as soon
as all NFSv4 clients were done with them, rather than waiting until
the filecache LRU had garbage collected them.

It gets the reference counting wrong, for one thing.

But it also misses that DELEGRETURN should release a file in the
same fashion. In fact, any nfsd_file_put() on an file held open
by an NFSv4 client needs potentially to release the file
immediately...

Clear the way for implementing that idea.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: NeilBrown <neilb@suse.de>
Stable-dep-of: 0b3a551fa58b ("nfsd: fix handling of cached open files in nfsd4_open codepath")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfsd/filecache.c
fs/nfsd/filecache.h
fs/nfsd/nfs4state.c

index ec3fceb92236eb3be76e42ee0107245559741d1e..babea79d3f6f28c8a355ecc41cc189ad886f830c 100644 (file)
@@ -444,24 +444,6 @@ nfsd_file_put(struct nfsd_file *nf)
                nfsd_file_put_noref(nf);
 }
 
-/**
- * nfsd_file_close - Close an nfsd_file
- * @nf: nfsd_file to close
- *
- * If this is the final reference for @nf, free it immediately.
- * This reflects an on-the-wire CLOSE or DELEGRETURN into the
- * VFS and exported filesystem.
- */
-void nfsd_file_close(struct nfsd_file *nf)
-{
-       nfsd_file_put(nf);
-       if (refcount_dec_if_one(&nf->nf_ref)) {
-               nfsd_file_unhash(nf);
-               nfsd_file_lru_remove(nf);
-               nfsd_file_free(nf);
-       }
-}
-
 struct nfsd_file *
 nfsd_file_get(struct nfsd_file *nf)
 {
index 357832bac736b89e2ebe5e159e54346e02cf983a..6b012ea4bd9da90c383af6093ea06568575c72f9 100644 (file)
@@ -52,7 +52,6 @@ void nfsd_file_cache_shutdown(void);
 int nfsd_file_cache_start_net(struct net *net);
 void nfsd_file_cache_shutdown_net(struct net *net);
 void nfsd_file_put(struct nfsd_file *nf);
-void nfsd_file_close(struct nfsd_file *nf);
 struct nfsd_file *nfsd_file_get(struct nfsd_file *nf);
 void nfsd_file_close_inode_sync(struct inode *inode);
 bool nfsd_file_is_cached(struct inode *inode);
index 52b5552d0d70e44fbc57f5579118f75961641274..16c3e991ddccb5b236a9c21027e26a6fc77a38d9 100644 (file)
@@ -842,9 +842,9 @@ static void __nfs4_file_put_access(struct nfs4_file *fp, int oflag)
                        swap(f2, fp->fi_fds[O_RDWR]);
                spin_unlock(&fp->fi_lock);
                if (f1)
-                       nfsd_file_close(f1);
+                       nfsd_file_put(f1);
                if (f2)
-                       nfsd_file_close(f2);
+                       nfsd_file_put(f2);
        }
 }