From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com ([66.111.4.25]:34889 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751590AbdITLuh (ORCPT ); Wed, 20 Sep 2017 07:50:37 -0400 From: Nikolaus Rath To: fuse-devel@lists.sourceforge.net, Miklos Szeredi , Maxim Patlasov , linux-fsdevel Subject: [fuse] getattr() results ignored when writeback cache is active Date: Wed, 20 Sep 2017 12:50:33 +0100 Message-ID: <87zi9pk2ra.fsf@vostro.rath.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --=-=-= Content-Type: text/plain 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): --=-=-= Content-Type: text/x-sh Content-Disposition: inline; filename=issue_93.sh 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 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable ,---- | $ ../issue_93.sh=20 | 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.=20 This is with kernel 4.9. Best, -Nikolaus --=20 GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F =C2=BBTime flies like an arrow, fruit flies like a Banana.=C2= =AB --=-=-=--