linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [fuse] getattr() results ignored when writeback cache is active
@ 2017-09-20 11:50 Nikolaus Rath
  2017-09-20 15:23 ` Miklos Szeredi
  0 siblings, 1 reply; 19+ messages in thread
From: Nikolaus Rath @ 2017-09-20 11:50 UTC (permalink / raw)
  To: fuse-devel, Miklos Szeredi, Maxim Patlasov, linux-fsdevel

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

Hi,

I'm having another problem with FUSE's writeback cache in SSHFS.

As far as I can tell, the FUSE kernel module issues getattr() requests,
but then silently discards the reported mtime and file size.

For SSHFS, this means that if a file has been accessed, and is then
changed on the server, the changed attributes don't make it to the
client and the file appears truncated or \0-filled.

To me this looks like a bug.. am I missing something?

Steps to reproduce (with SSHFS from Git master at
https://github.com/libfuse/sshfs/ and the debugging patch from
https://github.com/libfuse/sshfs/issues/93):


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: issue_93.sh --]
[-- Type: text/x-sh, Size: 734 bytes --]

mkdir /tmp/issue_93
touch /tmp/issue_93/file_1
mkdir /tmp/issue_93_mnt

dd if=/dev/urandom count=1 bs=2048 |base64 > /tmp/issue_93/file_1 2>/dev/null

./sshfs -f -o attr_timeout=0,entry_timeout=0,dir_cache=no,writeback_cache=yes \
        localhost:/tmp/issue_93/ /tmp/issue_93_mnt/ &
sleep 1
stat --format='Kernel: mtime %Y, size %s for %n' /tmp/issue_93_mnt/file_1
stat --format='Local:  mtime %Y, size %s for %n' /tmp/issue_93/file_1

sleep 1
echo "Changing file.."
echo -e "\nrevision 2" >> /tmp/issue_93/file_1

stat --format='Kernel: mtime %Y, size %s for %n' /tmp/issue_93_mnt/file_1
stat --format='Local:  mtime %Y, size %s for %n' /tmp/issue_93/file_1

fusermount -u /tmp/issue_93_mnt/

rm -r /tmp/issue_93 /tmp/issue_93_mnt

[-- Attachment #3: Type: text/plain, Size: 1044 bytes --]


,----
| $ ../issue_93.sh 
| 1+0 records in
| 1+0 records out
| 2048 bytes (2.0 kB, 2.0 KiB) copied, 5.3011e-05 s, 38.6 MB/s
| SSHFS:  mtime 0, size 0 for /.Trash
| SSHFS:  mtime 0, size 0 for /.Trash-1000
| SSHFS:  mtime 1505908107, size 2768 for /file_1
| SSHFS:  mtime 1505908107, size 2768 for /file_1
| Kernel: mtime 1505908107, size 2768 for /tmp/issue_93_mnt/file_1
| Local:  mtime 1505908107, size 2768 for /tmp/issue_93/file_1
| Changing file..
| SSHFS:  mtime 1505908109, size 2780 for /file_1
| SSHFS:  mtime 1505908109, size 2780 for /file_1
| Kernel: mtime 1505908107, size 2768 for /tmp/issue_93_mnt/file_1
| Local:  mtime 1505908109, size 2780 for /tmp/issue_93/file_1
`----

Note how sshfs' getattr handler returns the correct mtime and ctime for
the second stat() call, but the kernel returns the old values. 

This is with kernel 4.9.

Best,
-Nikolaus

-- 
GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2017-09-26  6:55 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-20 11:50 [fuse] getattr() results ignored when writeback cache is active Nikolaus Rath
2017-09-20 15:23 ` Miklos Szeredi
2017-09-20 15:31   ` [fuse-devel] " Nikolaus Rath
2017-09-20 15:59     ` Miklos Szeredi
2017-09-20 16:37       ` Nikolaus Rath
2017-09-21 15:04         ` Miklos Szeredi
2017-09-21 17:59           ` Nikolaus Rath
2017-09-25  9:12             ` Miklos Szeredi
2017-09-25  9:25               ` Nikolaus Rath
2017-09-21 10:12       ` Nikolaus Rath
2017-09-21 17:28         ` Maxim Patlasov
2017-09-21 17:53           ` Nikolaus Rath
2017-09-21 18:24             ` Maxim Patlasov
2017-09-21 18:31               ` Nikolaus Rath
2017-09-21 18:45                 ` Maxim Patlasov
2017-09-21 19:21                   ` Nikolaus Rath
2017-09-21 19:44                     ` Maxim Patlasov
2017-09-22  9:34                       ` Nikolaus Rath
2017-09-26  6:55                         ` Maxim Patlasov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).