On Thu, Nov 30, 2023 at 04:16:24PM +0200, Amir Goldstein wrote: > nfsd/ksmbd call vfs_copy_file_range() with flag COPY_FILE_SPLICE to > perform kernel copy between two files on any two filesystems. > > Splicing input file, while holding file_start_write() on the output file > which is on a different sb, posses a risk for fanotify related deadlocks. > > We only need to call splice_file_range() from within the context of > ->copy_file_range() filesystem methods with file_start_write() held. > > To avoid the possible deadlocks, always use do_splice_direct() instead of > splice_file_range() for the kernel copy fallback in vfs_copy_file_range() > without holding file_start_write(). Looks good: Reviewed-by: Christoph Hellwig <hch@xxxxxx> (although I wish do_splice_direct had a better name like vfs_splice_direct, espcially before growing more users)