You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
The text was updated successfully, but these errors were encountered:
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 callgetattr()
(which is implemented inpuniverse/javafs
asFileSystemProvider.readAttributes()
) and if that fails to callcreate()
(implemented inpuniverse/javafs
asFileSystemProvider.newByteChannel()
) followed byfgetattr()
- 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 anS3SeekableByteChannel
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 theFileSystemProvider
contract that specifies thatnewByteChannel()
"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 otherFileSystemProvider
methods.So when FUSE calls
readAttributes()
on the newly created file, the implementation throws aNoSuchFileException
instead of returning the attributes of the supposedly newly created file.The text was updated successfully, but these errors were encountered: