Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
guss77 opened this issue Dec 26, 2018 · 0 comments

Comments

@guss77
Copy link

guss77 commented Dec 26, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant