vfs: fix copy_file_range() averts filesystem freeze protection
vfs: fix copy_file_range() averts filesystem freeze protection
JIRA: https://issues.redhat.com/browse/RHEL-76048
Conflicts:
- Dropping fs/ksmbd hunk as we don't have this in RHEL
- RHEL also does not have the work to "Tidy up file permission hooks":
https://lore.kernel.org/all/20231122122715.2561213-1-amir73il@gmail.com/
so this patch drops the upstream hunk for lockdep_assert() check for the
superblock's s_writers.rw_sem, which would cause a build problem for
RHEL debug kernels.
commit 10bc8e4af65946b727728d7479c028742321b60a
Author: Amir Goldstein amir73il@gmail.com
Date: Thu Nov 17 22:52:49 2022 +0200
vfs: fix copy_file_range() averts filesystem freeze protection
Commit 868f9f2f8e00 ("vfs: fix copy_file_range() regression in cross-fs
copies") removed fallback to generic_copy_file_range() for cross-fs
cases inside vfs_copy_file_range().
To preserve behavior of nfsd and ksmbd server-side-copy, the fallback to
generic_copy_file_range() was added in nfsd and ksmbd code, but that
call is missing sb_start_write(), fsnotify hooks and more.
Ideally, nfsd and ksmbd would pass a flag to vfs_copy_file_range() that
will take care of the fallback, but that code would be subtle and we got
vfs_copy_file_range() logic wrong too many times already.
Instead, add a flag to explicitly request vfs_copy_file_range() to
perform only generic_copy_file_range() and let nfsd and ksmbd use this
flag only in the fallback path.
This choise keeps the logic changes to minimum in the non-nfsd/ksmbd code
paths to reduce the risk of further regressions.
Fixes: 868f9f2f8e00 ("vfs: fix copy_file_range() regression in cross-fs copies")
Tested-by: Namjae Jeon <linkinjeon@kernel.org>
Tested-by: Luis Henriques <lhenriques@suse.de>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Benjamin Coddington bcodding@redhat.com
Edited by Benjamin Coddington