Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

When mounted through a FUSE implementation (we're using puniverse/javafs), trying to write a new file always fails with NoSuchFileException but creates an empty file #118

@guss77

Description

@guss77

As explained in [this StackOverflow answer[(https://stackoverflow.com/questions/32212121/fuse-open-system-call-mechanism#), the way FUSE handles open(..,O_CREAT) (write to a file, creating if needed) is to call getattr() (which is implemented in puniverse/javafs as FileSystemProvider.readAttributes()) and if that fails to call create() (implemented in puniverse/javafs as FileSystemProvider.newByteChannel()) followed by fgetattr() - to check that the file was created correctly and it has the requested permissions.

Unfortunately, in Amazon-S3-FileSystem-NIO2, calling FileSystemProvider.newByteChannel() does not create a real object in S3 (at least not if multipart upload is disabled, which it is by default - I didn't check what happens with multipart upload). Instead it creates a new temporary file and an S3SeekableByteChannel instance that is not recorded anywhere - if the byte channel ever gets closed, only then a new S3 object is created. This can be viewed as a violation of the FileSystemProvider contract that specifies that newByteChannel() "Opens or creates a file" - the method opens an existing file, but if none exists it does not create a new file in any meaningful way viewable by other FileSystemProvider methods.

So when FUSE calls readAttributes() on the newly created file, the implementation throws a NoSuchFileException instead of returning the attributes of the supposedly newly created file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions