BACKPORT: fuse: always revalidate if exclusive create

commit df8629af293493757beccac2d3168fe5a315636e upstream.

Failure to do so may result in EEXIST even if the file only exists in the
cache and not in the filesystem.

The atomic nature of O_EXCL mandates that the cached state should be
ignored and existence verified anew.

Reported-by: Ken Schalk <kschalk@nvidia.com>
Change-Id: I7bc67048363004f94dfe7b74d0873c019f06eaef
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Wu Bo <bo.wu@vivo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Miklos Szeredi 2020-11-11 17:22:32 +01:00 • committed by Alexander Martinz
commit 3a772729dd
No known key found for this signature in database
GPG key ID: CF15BDD9A321A9B2

View file

@ -231,7 +231,6 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
inode = d_inode_rcu(entry);
if (inode && fuse_is_bad(inode))
goto invalid;
#ifdef CONFIG_FUSE_BPF
/* TODO: Do we need bpf support for revalidate?
* If the lower filesystem says the entry is invalid, FUSE probably shouldn't
@ -245,7 +244,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
}
#endif
if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) ||
(flags & LOOKUP_REVAL)) {
(flags & (LOOKUP_EXCL | LOOKUP_REVAL))) {
struct fuse_entry_out outarg;
struct fuse_entry_bpf bpf_arg;
FUSE_ARGS(args);