FUSE_COPY_FILE_RANGE instructs the server to write to a file. The fusefs module ought to evict any cached data in the range that it instructs the server to write. Unfortunately, today I noticed by inspection that it does not. This leads to a risk of data corruption when using copy_file_range with a FUSE file system that supports it (most don't). I should have a patch soon.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=41ae9f9e644d1196bebacdb3748670f36b354384 commit 41ae9f9e644d1196bebacdb3748670f36b354384 Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2021-12-05 20:39:10 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2021-12-07 04:41:50 +0000 fusefs: invalidate the cache during copy_file_range FUSE_COPY_FILE_RANGE instructs the server to write data to a file. fusefs must invalidate any cached data within the written range. PR: 260242 MFC after: 2 weeks Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D33280 sys/fs/fuse/fuse_vnops.c | 10 +++++ tests/sys/fs/fusefs/copy_file_range.cc | 78 ++++++++++++++++++++++++++++++++++ tests/sys/fs/fusefs/utils.cc | 4 +- tests/sys/fs/fusefs/utils.hh | 3 +- 4 files changed, 92 insertions(+), 3 deletions(-)
MFC not needed to stable/12 because it does not have copy_file_range.
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=642399932d58e880ac4a65ab6011a94292b37134 commit 642399932d58e880ac4a65ab6011a94292b37134 Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2021-12-05 20:39:10 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2022-01-03 03:03:54 +0000 fusefs: invalidate the cache during copy_file_range FUSE_COPY_FILE_RANGE instructs the server to write data to a file. fusefs must invalidate any cached data within the written range. PR: 260242 Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D33280 (cherry picked from commit 41ae9f9e644d1196bebacdb3748670f36b354384) sys/fs/fuse/fuse_vnops.c | 10 +++++ tests/sys/fs/fusefs/copy_file_range.cc | 78 ++++++++++++++++++++++++++++++++++ tests/sys/fs/fusefs/utils.cc | 4 +- tests/sys/fs/fusefs/utils.hh | 3 +- 4 files changed, 92 insertions(+), 3 deletions(-)