From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FE3085 for ; Mon, 4 Dec 2023 00:39:55 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id 1404568AFE; Mon, 4 Dec 2023 09:39:53 +0100 (CET) Date: Mon, 4 Dec 2023 09:39:52 +0100 From: Christoph Hellwig To: Amir Goldstein Cc: Christian Brauner , Jeff Layton , Josef Bacik , Christoph Hellwig , Jan Kara , David Howells , Jens Axboe , Miklos Szeredi , Al Viro , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2 3/3] fs: use do_splice_direct() for nfsd/ksmbd server-side-copy Message-ID: <20231204083952.GD32438@lst.de> References: <20231130141624.3338942-1-amir73il@gmail.com> <20231130141624.3338942-4-amir73il@gmail.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231130141624.3338942-4-amir73il@gmail.com> User-Agent: Mutt/1.5.17 (2007-11-01) 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 (although I wish do_splice_direct had a better name like vfs_splice_direct, espcially before growing more users)