On Wed, 21 Oct 2026, jamz wrote:
> From: Jimmy Zuber <[email protected]>
> 
> Add FUSE_OPEN_ATOMIC, allowing the kernel to skip LOOKUP to improve
> performance. A server implementing FUSE_OPEN_ATOMIC will look up
> the name, create it if O_CREAT is supplied, and open it in one request.
> 
> The reply says whether the file was created, as Miklos suggested in [1].
> The overall pattern follows his sketch in [2]. For a cached
> name, the kernel compares the returned nodeid with the cached one and
> looks the name up again on a mismatch.
> 
> A server without FUSE_OPEN_ATOMIC replies -ENOSYS and keeps today's
> behaviour.

This all looks like a reasonably sensible design. As permission checking
happens in the client, not on the server, it is appropriate that
FUSE_OPEN_ATOMIC only opens the file if it actually created it.
So it doesn't make sense to implement O_TRUNC.

However the code seems to suggest that the server might open the file if
it was found to already exist.  In that case, were does the permission
check happen...

Maybe I need a more explicit statement of what FUSE_OPEN_ATOMIC is meant
to do in the various cases.  Or maybe I just don't know enough about
fuse.

There is work underway to support O_CREAT|O_DIRECTORY so that a
directory can be created and opened in a single operation.  Would it
make sense to include this in FUSE_OPEN_ATOMIC ??

Thanks,
NeilBrown



> 
> Tested with a new selftest under UML and KVM.
> 
> [1] 
> https://lore.kernel.org/all/CAJfpeguEK4JsFo60=yhkpll6xkdgs7cq5gohifl379ksyk0...@mail.gmail.com/
> [2] 
> https://lore.kernel.org/all/CAJfpegvXtXY=pbxv+dmgfr8mvwn0duwhso6nwavexk6y6sa...@mail.gmail.com/
> 
> 
> Jimmy Zuber (3):
>   fuse: add FUSE_OPEN_ATOMIC
>   fuse: open cached files with FUSE_OPEN_ATOMIC
>   selftests/fuse: add test for FUSE_OPEN_ATOMIC
> 
>  fs/fuse/dir.c                                 | 359 +++++++++++--
>  fs/fuse/file.c                                |   4 +-
>  fs/fuse/fuse_i.h                              |   4 +
>  include/uapi/linux/fuse.h                     |   8 +-
>  .../selftests/filesystems/fuse/.gitignore     |   1 +
>  .../selftests/filesystems/fuse/Makefile       |   3 +-
>  .../filesystems/fuse/atomic_open_test.c       | 473 ++++++++++++++++++
>  7 files changed, 797 insertions(+), 55 deletions(-)
>  create mode 100644 
> tools/testing/selftests/filesystems/fuse/atomic_open_test.c
> 
> 
> base-commit: b776cbe24cc1b79c7f5101762b0069b3f48b6a4b
> -- 
> 2.50.1
> 
> 


Reply via email to