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

Document -o writeback_cache in manpage #82

Closed
waldner opened this issue Aug 16, 2017 · 12 comments
Closed

Document -o writeback_cache in manpage #82

waldner opened this issue Aug 16, 2017 · 12 comments
Assignees
Labels

Comments

@waldner
Copy link

waldner commented Aug 16, 2017

After upgrading to 3.2.0, a program that was writing files in an sshfs-mounted directory started reporting errors. With strace, I see that what fails is the following operation:

open("/sshfs/mounted/dir/2017-08-16.184559+0200CEST.txt", O_WRONLY|O_CREAT|O_APPEND, 0666) = -1 EINVAL (Invalid argument)

I'm not sure what has changed with 3.2, surely I didn't do anything different. The directory is mounted with the following line in fstab:

user@host:/remote/dir /sshfs/mounted/dir fuse.sshfs noauto,x-systemd.automount,_netdev,user,idmap=user,reconnect,transform_symlinks,identityfile=/path/to/id_ed25519,addressfamily=inet,port=45678,allow_other,default_permissions,uid=1000,gid=1000 0 0

Also, I can create files under the directory in question (with touch, redirections etc) from the shell, as the same user the program runs as.

@Nikratio
Copy link
Contributor

Probably the problem is with O_APPEND. From the manpage:

CAVEATS / WORKAROUNDS
[...]
   O_APPEND
       When  writeback  caching is enabled, SSHFS cannot reliably support the O_APPEND open
       flag and thus signals an error on open.  To enable support for  unreliable  O_APPEND
       (which  may  overwrite  data if the file changes on the server at a bad time), mount
       the file system with -o unreliable_append.

Does that help?

@waldner
Copy link
Author

waldner commented Aug 17, 2017

Well, I can't change the application behavior, so I'll try with the unreliable_append flag. Thanks

@waldner
Copy link
Author

waldner commented Aug 17, 2017

With unreliable_append it does work. Thanks!

@waldner waldner closed this as completed Aug 17, 2017
@Nikratio
Copy link
Contributor

Alternatively, you could also disable writeback cache.

@waldner
Copy link
Author

waldner commented Aug 17, 2017

Which man page are you referring to? I don't see the section you mentioned earlier in the man page on my system, and not even here: https://github.com/libfuse/sshfs/blob/master/sshfs.1.in. It looks like it's the man page for SSHFS version 2.0? Also, on my system running "sshfs --version" produces

SSHFS version 3.1.0
FUSE library version 3.1.1
using FUSE kernel interface version 7.26
fusermount3 version: 3.1.1

but the package manager tells me that I have 3.2.0 installed (and the fact that unreliable_append works seems to confirm it). Is the wrong version number a distro issue (Arch Linux)?

@Nikratio
Copy link
Contributor

The one that so far only lived in my local clone and that I just pushed to GitHub of course! What else?

(Sorry!)

@Nikratio
Copy link
Contributor

@waldner
Copy link
Author

waldner commented Aug 18, 2017

Well, I still don't see how to disable writeback cache from that man page :-)

@Nikratio Nikratio changed the title Getting EINVAL with 3.2 Document -o writeback_cache in manpage Aug 18, 2017
@Nikratio Nikratio self-assigned this Aug 18, 2017
@Nikratio Nikratio added bug and removed needs-info labels Aug 18, 2017
@Nikratio Nikratio reopened this Aug 18, 2017
@pounard
Copy link

pounard commented Aug 23, 2017

@Nikratio Searching this repository I could find this: https://github.com/libfuse/sshfs/search?utf8=%E2%9C%93&q=writeback_cache&type=

From what I see, you should set -o writeback_cache=no I guess.

I stumbled upon the same bug after upgrade, so I'll try it right now :)

@plroman
Copy link

plroman commented Aug 29, 2017

Same problem when using git with sshfs 3.2, I don't get these errors with 3.0:

$ git pull
error: cannot open .git/FETCH_HEAD: Invalid argument
$ git commit -m 'should have used svn'
fatal: cannot update the ref 'HEAD': unable to append to '.git/logs/HEAD': Invalid argument
$ strace git commit -m 'or maybe cvs'
[...]
open(".git/logs/HEAD", O_WRONLY|O_CREAT|O_APPEND, 0666) = -1 EINVAL (Invalid argument)
[...]

It works with -o writeback_cache=no (or -o unreliable_append). Thank you for that quick fix.

@pounard
Copy link

pounard commented Aug 30, 2017

I still have a lot of random failures with git (at least once or twice a day, hence the "random") which I didn't have with versions <= 3 (even after I set the writeback_cache option)

@Nikratio
Copy link
Contributor

Looking at issue #88, we should make sure that the documentation explains that behavior.

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

No branches or pull requests

4 participants