Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Files appear truncated when writeback cache is active #88
Comments
|
Thanks for the report! Does mounting with |
Nikratio
added
the
needs-info
label
Sep 7, 2017
brettowe
commented
Sep 8, 2017
|
yes adding that option looks to solve it should mention as it looks like I forgot to previously I'd consider this a regression as I hadn't seen the issue on previous versions |
tksuoran
commented
Sep 13, 2017
•
|
I am also experiencing this issue. I am using Ubuntu 16.04. Due to #7 (which I also can reproduce consistently) I have removed stock libfuse and sshfs packages and instead manually built and installed latest libfuse and sshfs. sshfs --version output: SSHFS version 3.2.0 When working with sshfs mount, I can 100% reproduce a case in which a file appears truncated when seen through sshfs. Meanwhile the file is complete in the remote end. Using -o writeback_cache=no avoids the issue. It seems to be as writeback cache is broken in sshfs 3.2.0. |
|
@tksuoran thanks for reporting this! Hopefully I won't need a Raspberry Pi to reproduce the problem then :-). Could you provide more detailed instructions for reproducing the issue? Ideally would be a script that connects to localhost and triggers the problem. |
Nikratio
changed the title from
corruption issues
to
Files appear truncated when writeback cache is active
Sep 19, 2017
Nikratio
self-assigned this
Sep 19, 2017
Nikratio
added
the
bug
label
Sep 19, 2017
|
Apologies for taking so long to realize this, but I just read the original problem description again and this behavior is actually expected. Enabling writeback caching means you have no control over when written data will actually be transmitted to the client. Seeing incorrect data on the server while the filesystem is mounted is expected behavior - if you don't want that, do not use writeback caching :-). It would be different if the files were still truncated after unmounting, or if they also appeared truncated on the client - but if I understand correctly, this isn't the case, right? |
Nikratio
removed
the
bug
label
Sep 19, 2017
brettowe
commented
Sep 19, 2017
|
the client I assume would be the one using sshfs to make the mount point locally |
|
That is expected behavior as well. However, since people have apparently been relying on this, it may be an argument for not enabling writeback caching by default. Hmm.. |
brettowe
commented
Sep 19, 2017
|
I'll submit that nfs can do this without special options |
mk-fg
commented
Sep 19, 2017
Current default behavior - silent data corruption after any remote change (which is quite common when using sshfs for e.g. configuration) - is very surprising and terrible in a filesystem, while slower operation in some cases is not surprising at all for network fs and will not screw anyone over. Documentation for such cache should have huge warning in all-caps imho, and maybe even print one when used, instead of being on by default. |
mk-fg
commented
Sep 20, 2017
It's interesting that I've bumped into this issue with arm boards as well. Either old or new version of it wouldn't be that surprising with caching, but corrupted version is - should option really produce that behavior? I mean, at the time of reading file contents on remote host should be perfectly stable and valid, and there are no NUL bytes in it, nor ever were, why'd sshfs ever return these? |
|
Lots of comments, let's see if I can address them all:
|
mk-fg
commented
Sep 20, 2017
Yeah, sorry, will definitely try to do that in the next few days, seem to be 100% reproducible here, so gotta be worst-case reproducible with qemu-user-aarch64/arm chroot and/or netem, though hopefully with simple localhost connection as well. Thanks! |
|
I think the reported problems may have the same root cause as #93 - if the attributes are not updated correctly, the file contents would appear truncated or zero-filled. |
brettowe
commented
Sep 20, 2017
|
my comment was mainly pointing out that another remote filesystem can be treated this way and no corruption happens nor is it expected. my usage case is in 1 sshfs to the pi from desktop 2nd way is on pi sshfs to desktop |
Nikratio
closed this
in
d193b19
Sep 20, 2017
mk-fg
commented
Sep 20, 2017
|
Oh well, sshfs is awesome for many purposes that don't really need cache anyway. |
brettowe commentedSep 1, 2017
•
Edited 1 time
-
brettowe
Sep 1, 2017
I'm using sshfs 3.2.0 on arch between a raspberry pi and an x86 box
sshfs being ran on the pi in this case but I had the reverse do the same
if in the first case I connect directory to my x86 box and I edit a file with vim for example and save
the file that is accessed on the pi is corrupt for say using golang and building i see errors like
"invalid NUL character" pointing to a line 1 higher than EOF
and "syntax error: unexpected EOF, expecting }"
when I was doing the reverse and looking at png files made on the pi viewing from x86 i would see the lower 3rd or so show corruption
the pngs were made from gnuplot
looking at md5s or whichever shows mismatch
ls -l for files looks same tho
if drop the mount and reconnect files are fine
I've tried playing with the cache options none seem to help
also tried resaving or regenerating the files and once corrupt they never seem to stop until disconnection