Commit dcf3f809 authored by Chuck Lever's avatar Chuck Lever

NFSD: Revert "NFSD: NFSv4 CLOSE should release an nfsd_file immediately"

This reverts commit 5e138c4a.

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: default avatarChuck Lever <chuck.lever@oracle.com>
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Reviewed-by: default avatarNeilBrown <neilb@suse.de>
parent c2528490
...@@ -444,24 +444,6 @@ nfsd_file_put(struct nfsd_file *nf) ...@@ -444,24 +444,6 @@ nfsd_file_put(struct nfsd_file *nf)
nfsd_file_put_noref(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 * struct nfsd_file *
nfsd_file_get(struct nfsd_file *nf) nfsd_file_get(struct nfsd_file *nf)
{ {
......
...@@ -52,7 +52,6 @@ void nfsd_file_cache_shutdown(void); ...@@ -52,7 +52,6 @@ void nfsd_file_cache_shutdown(void);
int nfsd_file_cache_start_net(struct net *net); int nfsd_file_cache_start_net(struct net *net);
void nfsd_file_cache_shutdown_net(struct net *net); void nfsd_file_cache_shutdown_net(struct net *net);
void nfsd_file_put(struct nfsd_file *nf); 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); struct nfsd_file *nfsd_file_get(struct nfsd_file *nf);
void nfsd_file_close_inode_sync(struct inode *inode); void nfsd_file_close_inode_sync(struct inode *inode);
bool nfsd_file_is_cached(struct inode *inode); bool nfsd_file_is_cached(struct inode *inode);
......
...@@ -842,9 +842,9 @@ static void __nfs4_file_put_access(struct nfs4_file *fp, int oflag) ...@@ -842,9 +842,9 @@ static void __nfs4_file_put_access(struct nfs4_file *fp, int oflag)
swap(f2, fp->fi_fds[O_RDWR]); swap(f2, fp->fi_fds[O_RDWR]);
spin_unlock(&fp->fi_lock); spin_unlock(&fp->fi_lock);
if (f1) if (f1)
nfsd_file_close(f1); nfsd_file_put(f1);
if (f2) if (f2)
nfsd_file_close(f2); nfsd_file_put(f2);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment