Weird fuse_operations.read calls with Linux 5.4

From: Ondrej Holy
Date: Wed Jan 15 2020 - 03:28:07 EST


Hi,

I have been directed here from https://github.com/libfuse/libfuse/issues/488.

My issue is that with Linux Kernel 5.4, one read kernel call (e.g.
made by cat tool) triggers two fuse_operations.read executions and in
both cases with 0 offset even though that first read successfully
returned some bytes.

For gvfs, it leads to redundant I/O operations, or to "Operation not
supported" errors if seeking is not supported. This doesn't happen
with Linux 5.3. Any idea what is wrong here?

$ strace cat /run/user/1000/gvfs/ftp\:host\=server\,user\=user/foo
...
openat(AT_FDCWD, "/run/user/1000/gvfs/ftp:host=server,user=user/foo",
O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=20, ...}) = 0
fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) = 0
mmap(NULL, 139264, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0x7fbc42b92000
read(3, 0x7fbc42b93000, 131072) = -1 EOPNOTSUPP (Operation not
supported)
...

$ /usr/libexec/gvfsd-fuse /run/user/1000/gvfs -d
...
open flags: 0x8000 /ftp:host=server,user=user/foo
open[139679517117488] flags: 0x8000 /ftp:host=server,user=user/foo
unique: 8, success, outsize: 32
unique: 10, opcode: READ (15), nodeid: 3, insize: 80, pid: 5053
read[139679517117488] 4096 bytes from 0 flags: 0x8000
read[139679517117488] 20 bytes from 0
unique: 10, success, outsize: 36
unique: 12, opcode: READ (15), nodeid: 3, insize: 80, pid: 5053
read[139679517117488] 4096 bytes from 0 flags: 0x8000
unique: 12, error: -95 (Operation not supported), outsize: 16
...

See for other information: https://gitlab.gnome.org/GNOME/gvfs/issues/441

Regards

Ondrej
--
Ondrej Holy
Software Engineer, Core Desktop Development
Red Hat Czech s.r.o