[fuse] getattr() results ignored when writeback cache is active

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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):

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
,----
| $ ../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.«

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux