From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB2B010DF for ; Thu, 30 Nov 2023 05:32:55 -0800 (PST) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A2E7A1F8BF; Thu, 30 Nov 2023 13:32:51 +0000 (UTC) Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 85E75138E5; Thu, 30 Nov 2023 13:32:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id KoVnIAOPaGVhYQAAn2gu4w (envelope-from ); Thu, 30 Nov 2023 13:32:51 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id B7ED8A07DB; Thu, 30 Nov 2023 14:32:50 +0100 (CET) Date: Thu, 30 Nov 2023 14:32:50 +0100 From: Jan Kara 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 2/2] fs: move file_start_write() into direct_splice_actor() Message-ID: <20231130133250.z6d7fdx67unlicle@quack3> References: <20231129200709.3154370-1-amir73il@gmail.com> <20231129200709.3154370-3-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: <20231129200709.3154370-3-amir73il@gmail.com> X-Spamd-Bar: ++++++ Authentication-Results: smtp-out2.suse.de; dkim=none; dmarc=none; spf=softfail (smtp-out2.suse.de: 2a07:de40:b281:104:10:150:64:98 is neither permitted nor denied by domain of jack@suse.cz) smtp.mailfrom=jack@suse.cz X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [6.41 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:98:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_NOT_FQDN(0.50)[]; DMARC_NA(1.20)[suse.cz]; R_SPF_SOFTFAIL(4.60)[~all:c]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[11]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email,suse.com:email,toxicpanda.com:email]; FREEMAIL_TO(0.00)[gmail.com]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(2.20)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.98)[86.91%] X-Spam-Score: 6.41 X-Rspamd-Queue-Id: A2E7A1F8BF On Wed 29-11-23 22:07:09, Amir Goldstein wrote: > The two callers of do_splice_direct() hold file_start_write() on the > output file. > > This may cause file permission hooks to be called indirectly on an > overlayfs lower layer, which is on the same filesystem of the output > file and could lead to deadlock with fanotify permission events. > > To fix this potential deadlock, move file_start_write() from the callers > into the direct_splice_actor(), so file_start_write() will not be held > while reading the input file. > > Suggested-by: Josef Bacik > Link: https://lore.kernel.org/r/20231128214258.GA2398475@perftesting/ > Signed-off-by: Amir Goldstein Yeah, very nice solution! It all looks good to me so feel free to add: Reviewed-by: Jan Kara Honza -- Jan Kara SUSE Labs, CR