All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolaus Rath <Nikolaus@rath.org>
To: fuse-devel@lists.sourceforge.net,
	Miklos Szeredi <mszeredi@redhat.com>,
	Maxim Patlasov <mpatlasov@virtuozzo.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: [fuse] getattr() results ignored when writeback cache is active
Date: Wed, 20 Sep 2017 12:50:33 +0100	[thread overview]
Message-ID: <87zi9pk2ra.fsf@vostro.rath.org> (raw)

[-- 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.«

             reply	other threads:[~2017-09-20 11:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20 11:50 Nikolaus Rath [this message]
2017-09-20 15:23 ` [fuse] getattr() results ignored when writeback cache is active 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zi9pk2ra.fsf@vostro.rath.org \
    --to=nikolaus@rath.org \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mpatlasov@virtuozzo.com \
    --cc=mszeredi@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.