diff options
author | Jeff Layton <jeff.layton@primarydata.com> | 2019-08-18 20:18:57 +0200 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2019-08-19 17:09:10 +0200 |
commit | 7775ec57f4c71309109f9e98cf8854a2ca8c9df1 (patch) | |
tree | a5c20ba739bdc4692bb7b2ae399d249eea9d1c5e /fs/nfsd/nfs4xdr.c | |
parent | nfsd: rip out the raparms cache (diff) | |
download | linux-7775ec57f4c71309109f9e98cf8854a2ca8c9df1.tar.xz linux-7775ec57f4c71309109f9e98cf8854a2ca8c9df1.zip |
nfsd: close cached files prior to a REMOVE or RENAME that would replace target
It's not uncommon for some workloads to do a bunch of I/O to a file and
delete it just afterward. If knfsd has a cached open file however, then
the file may still be open when the dentry is unlinked. If the
underlying filesystem is nfs, then that could trigger it to do a
sillyrename.
On a REMOVE or RENAME scan the nfsd_file cache for open files that
correspond to the inode, and proactively unhash and put their
references. This should prevent any delete-on-last-close activity from
occurring, solely due to knfsd's open file cache.
This must be done synchronously though so we use the variants that call
flush_delayed_fput. There are deadlock possibilities if you call
flush_delayed_fput while holding locks, however. In the case of
nfsd_rename, we don't even do the lookups of the dentries to be renamed
until we've locked for rename.
Once we've figured out what the target dentry is for a rename, check to
see whether there are cached open files associated with it. If there
are, then unwind all of the locking, close them all, and then reattempt
the rename.
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions