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

Calling fcntl(..., F_FULLFSYNC) on osxfuse volume returns "Invalid argument" error #79

Closed
AlexPlas opened this issue Apr 10, 2013 · 6 comments
Assignees
Milestone

Comments

@AlexPlas
Copy link

@AlexPlas AlexPlas commented Apr 10, 2013

Here is a simple test application which returns "Invalid argument" error for any file located on the osxfuse volume. I've tested it on my own FS and on SSHFS from the site as well.

#include <fcntl.h> 
int main(int argc, char **argv) 
{ 
    int fd; 
    argc--; 
    argv++; 
    if(argc<1) exit(0); 
    fd = open(*argv, O_RDWR|O_CREAT); 
    if(fd<0) { 
        perror("OPEN"); 
        exit(0); 
    } 
    if(write(fd,"test",4)<0) { 
        perror("WRITE"); 
        exit(0); 
    } 
    if(fcntl(fd, F_FULLFSYNC) < 0) { 
        perror("FCNTL"); 
        exit(0); 
    } 
    close(fd); 
}
@dbgreen

This comment has been minimized.

Copy link

@dbgreen dbgreen commented Apr 15, 2013

Basically, any program that tries to do a full-sync will have issues. We also noticed this trying to run a database in an OSXFuse fs.

@bfleischer

This comment has been minimized.

Copy link
Member

@bfleischer bfleischer commented Apr 15, 2013

Sorry for the late reply.

F_FULLFSYNC is currently not implemented. Thats why you are seeing the error. From a technical standpoint there would be no difference between calling fsync or fcntl with F_FULLFSYNC on a FUSE volume. For volumes that are actually backed by a physical hard drive is makes a difference though. Implementing F_FULLFSYNC should not be too difficult.

On a side note, running a database on a FUSE volume might not be ideal because of the overhead and it will be very difficult to guarantee data integrity in case of a file system crash. Depending on the file system there might be several layers of caching that are not getting flushed when calling fsync or doing a fnctl with F_FULLFSYNC.

@dbgreen

This comment has been minimized.

Copy link

@dbgreen dbgreen commented Apr 15, 2013

Benjamin,
The real problem for us is that we want to be able to run third party
software from within the fs, and since we don't control the code we can't
disable the full_sync. I personally would be fine if there were just a way
to accept the call but not do the full_sync, just do a fsync instead.
Right now it triggers an invalid arg error though.

On Mon, Apr 15, 2013 at 12:24 PM, Benjamin Fleischer <
notifications@github.com> wrote:

Sorry for the late reply.

From a technical standpoint there would be no difference between calling
fsync or fcntl with F_FULLFSYNC on a FUSE volume. For volumes that are
actually backed by a physical hard drive is makes a difference though.


Reply to this email directly or view it on GitHubhttps://github.com//issues/79#issuecomment-16399077
.

@bfleischer

This comment has been minimized.

Copy link
Member

@bfleischer bfleischer commented Apr 15, 2013

I edited my previous reply shortly after posting it.You might not have received a notification containing the edited version.

I agree that we should be doing a plain fsync when fnctl is called with F_FULLFSYNC. Just accepting the call is not a good solution because it might cause data loss for some users.

@ghost ghost assigned bfleischer Apr 15, 2013
@dbgreen

This comment has been minimized.

Copy link

@dbgreen dbgreen commented Apr 16, 2013

Yeah, I agree that doing a plain fsync when fcntl is called with F_FULLSYNC is called would be the way to go.

@bfleischer

This comment has been minimized.

Copy link
Member

@bfleischer bfleischer commented Apr 23, 2013

Commit osxfuse/kext@e940e7d adds support for F_FULLSYNC. Please let me know if you encounter any problems with the patch.

@bfleischer bfleischer closed this Apr 23, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.