linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH] fuse : Improve file open behavior for recently created/unlinked files
@ 2020-11-20 22:35 Ken Schalk
  2020-11-23 10:40 ` Miklos Szeredi
  0 siblings, 1 reply; 2+ messages in thread
From: Ken Schalk @ 2020-11-20 22:35 UTC (permalink / raw)
  To: linux-fsdevel, fuse-devel; +Cc: Miklos Szeredi

When a dentry exists for the path argument to an open with O_CREAT or
a negative dentry exists for the path argument to any open, make a
lookup request to the user-space daemon to verify the
existence/non-existence of the path.

This improves file open behavior for a FUSE filesystem where changes
may be made without going through the mount point, such as a
distributed filesystem accessed concurrently from multiple hosts.
Specifically:

- For an open with O_CREAT of a path with a cached dentry, the
  user-space daemon is able to report a recent unlink of a file
  allowing it to be re-created rather than either the open failing
  with EEXIST (when O_EXCL is used) or a FUSE open request causing the
  open to fail with ENOENT (when O_EXCL is not used).

- For an open of a path with a cached negative dentry, the user-space
  daemon is able to report the recent creation of a file allowing it
  to be opened rather than the open failing with ENOENT.

This is intended to be functionally equivalent to behavior in the NFS
client which re-validates a cached dentry on file open.

Signed-off-by: Kenneth C Schalk <kschalk@nvidia.com>
---
 fs/fuse/dir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 5d43af1..eab0288 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -205,7 +205,8 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
        if (inode && is_bad_inode(inode))
                goto invalid;
        else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) ||
-                (flags & (LOOKUP_EXCL | LOOKUP_REVAL))) {
+                (!inode && (flags & LOOKUP_OPEN)) ||
+                (flags & (LOOKUP_CREATE | LOOKUP_REVAL))) {
                struct fuse_entry_out outarg;
                FUSE_ARGS(args);
                struct fuse_forget_link *forget;
--
2.9.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RESEND PATCH] fuse : Improve file open behavior for recently created/unlinked files
  2020-11-20 22:35 [RESEND PATCH] fuse : Improve file open behavior for recently created/unlinked files Ken Schalk
@ 2020-11-23 10:40 ` Miklos Szeredi
  0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2020-11-23 10:40 UTC (permalink / raw)
  To: Ken Schalk; +Cc: linux-fsdevel, fuse-devel

On Fri, Nov 20, 2020 at 11:35 PM Ken Schalk <kschalk@nvidia.com> wrote:
>
> When a dentry exists for the path argument to an open with O_CREAT or
> a negative dentry exists for the path argument to any open, make a
> lookup request to the user-space daemon to verify the
> existence/non-existence of the path.
>
> This improves file open behavior for a FUSE filesystem where changes
> may be made without going through the mount point, such as a
> distributed filesystem accessed concurrently from multiple hosts.
> Specifically:
>
> - For an open with O_CREAT of a path with a cached dentry, the
>   user-space daemon is able to report a recent unlink of a file
>   allowing it to be re-created rather than either the open failing
>   with EEXIST (when O_EXCL is used) or a FUSE open request causing the
>   open to fail with ENOENT (when O_EXCL is not used).
>
> - For an open of a path with a cached negative dentry, the user-space
>   daemon is able to report the recent creation of a file allowing it
>   to be opened rather than the open failing with ENOENT.
>
> This is intended to be functionally equivalent to behavior in the NFS
> client which re-validates a cached dentry on file open.

You haven't replied to this:

https://lore.kernel.org/linux-fsdevel/CAJfpegv5EckmJ_PCqHc2N3_jHaXfinMwvDNSttYNXcan1wr1fQ@mail.gmail.com/

Thanks,
Miklos

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-23 10:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 22:35 [RESEND PATCH] fuse : Improve file open behavior for recently created/unlinked files Ken Schalk
2020-11-23 10:40 ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).