]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r358867:
authorAlan Somers <asomers@FreeBSD.org>
Sun, 22 Mar 2020 15:24:25 +0000 (15:24 +0000)
committerAlan Somers <asomers@FreeBSD.org>
Sun, 22 Mar 2020 15:24:25 +0000 (15:24 +0000)
commitf0ebf80364c85feaea24b4aa247e5efe6e1b7733
tree83374c336bc48b57c5d263e356ae61151c8d92ea
parent69a5eb50ca40879900d7911b676ec619438a5207
MFC r358867:

fusefs: avoid cache corruption with buggy fuse servers

The FUSE protocol allows the client (kernel) to cache a file's size, if the
server (userspace daemon) allows it. A well-behaved daemon obviously should
not change a file's size while a client has it cached. But a buggy daemon
might. If the kernel ever detects that that has happened, then it should
invalidate the entire cache for that file. Previously, we would not only
cache stale data, but in the case of a file extension while we had the size
cached, we accidentally extended the cache with zeros.

PR: 244178
Reported by: Ben RUBSON <ben.rubson@gmx.com>
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D24012
sys/fs/fuse/fuse_internal.c
sys/fs/fuse/fuse_node.c
sys/fs/fuse/fuse_node.h
sys/fs/fuse/fuse_vnops.c
tests/sys/fs/fusefs/Makefile
tests/sys/fs/fusefs/cache.cc [new file with mode: 0644]
tests/sys/fs/fusefs/getattr.cc
tests/sys/fs/fusefs/io.cc
tests/sys/fs/fusefs/utils.cc
tests/sys/fs/fusefs/utils.hh