Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp407073lqr; Wed, 5 Jun 2024 09:19:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLOCxYYUEro+IFMa0zeu2aIAqUIowF208fbNprX+ScO290rWm0FsDS7b5D8oacYgm2bnfET8rsgwK1KHRWmm2MUGqRfizlAitY4iMgmQ== X-Google-Smtp-Source: AGHT+IFEumxO8knNc+9f5pKPh6qg5Sk9EjpGkCO8kJk1iXYG/57TTr0lGrtKAokWcojzTSKKGbgE X-Received: by 2002:a05:6102:4420:b0:47c:2879:bbe1 with SMTP id ada2fe7eead31-48c0481b9ccmr3869312137.6.1717604356980; Wed, 05 Jun 2024 09:19:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717604356; cv=pass; d=google.com; s=arc-20160816; b=rBvoZXWI8Vcbe/CsxJeYLyfiRRTnxumt00xpIobKIz9dBWpP2wSGKZr1Kwj7YUNzW/ ZH57/9zZHiGVBP1WaVC9GrrZRX/owgVfEep0HJ4stY1UgH/7cgJnzugXxoIltDBaONP7 pNy4zzUMOoAHazFZNl9RETLLFoMtJfx3lZczfV9lYNovFTcj/EqAxyvpdTzn5ERTqpWB 4TJxKTztAOvYPZRKQ8OXIB/MKbK94ojn/xCSJFpnbicfxGTr32YKgJfm1YZkAf0fda/q zfROjwqz2Rkac645M59VAOY7leqKr7kEHNk9LBbzlDWROWynvjSeI/sMFS0nJShH2JDF BbYQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature:dkim-signature:dkim-signature; bh=cVUQtlRLszCU94XAJg4Sr2x5/iksbWcHEIMrG0v+xrc=; fh=z5xTUq7n9It90uf5x/GAZjOWmdmlUmoVmK3Z9ewSC70=; b=EV4q4K7NO5B/cC1ti84o+LJ4lAoeC3rnfZHOmxwSo1qm3cNP0gHs5bjxK1i4i2nOyC f9pFPMYDgzGHFqnQDGtFWes60n8SV6e0m/z/+rZ0JxFU99rE7Sg6shdmHJOB+9AQbdEB nizFQk4MA9z1gBrTFPmPUA7WNgqaGfo8n8o2yf9RjWQhgoOIQNuU/z+IWdgAGVms4UOi XuoBIiCHdpfGnW/T1ltEqiE3c8HJG7mfR4Yn41QTrb+BUaX7Tv6lQVVEu3G9smkiBryQ 2O8FefkcLV++t0CsXa4RGYqdz8M13ku0lNKP7UPk4V++hqcK1hvAmShHiN74Khsob2q+ NBCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dIkUGvpu; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dIkUGvpu; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-202903-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202903-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ada2fe7eead31-48be9735908si1392810137.83.2024.06.05.09.19.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 09:19:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202903-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dIkUGvpu; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dIkUGvpu; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-202903-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202903-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 98E991C2377E for ; Wed, 5 Jun 2024 16:19:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D84F115F322; Wed, 5 Jun 2024 16:19:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="dIkUGvpu"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="eBIdPu1d"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="dIkUGvpu"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="eBIdPu1d" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4ACB619D899; Wed, 5 Jun 2024 16:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717604343; cv=none; b=Z1I7Ss3dHTVrFBZdFE98/Gga4CcgqcBGrwNm3yi19SkSaYOBo3D/ZOFAL3/clFRGcfUPUb8IT9BV2QsYZIgaNpV3561ziR2eBYJ+8oSlp/AO+YpD7WhtPBgCpRPk7DcHrPzgIsDU958++RZPEkL/j/+A4MssXdRYZqD4NnqcsMs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717604343; c=relaxed/simple; bh=lHV5wwB9e3B2P0F3EVrAQ7ztBPk4L/SA7XMeetXBSy0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MA7syTEfQY+Le7J2mfOKNaR+Uk94+U+TjkBcUT4E+eNKoNt46+ZDxp8s+VXEAhKtoMJkwaGIOjkOnICGp6s49ALvvOtw4dGbZF/KxmKk/WX7ZlnQpGfWpdo4J040rge8ekHRNxiVwRe9oFSwzt48VKU7pgQG0MuHXia4CKyri9g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=dIkUGvpu; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=eBIdPu1d; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=dIkUGvpu; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=eBIdPu1d; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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-out1.suse.de (Postfix) with ESMTPS id 63A0C21A7D; Wed, 5 Jun 2024 16:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1717604339; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cVUQtlRLszCU94XAJg4Sr2x5/iksbWcHEIMrG0v+xrc=; b=dIkUGvpuXjyw8hWpX0TCGxHMJzIwndbSEfMyUR61koOqjgd3gZ87h85g3MqkIskdjfFUhX RfGyCNBpysOEG8Yfg11A7COSDlVYZlHWjP6s7NG2TPhAubquIL6p6vZFJV84M28B/iU1+P RCbTHGsS/AtYfbh7WwjAhQLmZqRucIc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1717604339; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cVUQtlRLszCU94XAJg4Sr2x5/iksbWcHEIMrG0v+xrc=; b=eBIdPu1dlG0VDL3zSNN9m6cB840iiZOKYWePAKCDOIGSz2dh7VNcU0mhxBhWYLGzUb99CX jeKIs2BwIBpH0xDg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1717604339; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cVUQtlRLszCU94XAJg4Sr2x5/iksbWcHEIMrG0v+xrc=; b=dIkUGvpuXjyw8hWpX0TCGxHMJzIwndbSEfMyUR61koOqjgd3gZ87h85g3MqkIskdjfFUhX RfGyCNBpysOEG8Yfg11A7COSDlVYZlHWjP6s7NG2TPhAubquIL6p6vZFJV84M28B/iU1+P RCbTHGsS/AtYfbh7WwjAhQLmZqRucIc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1717604339; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cVUQtlRLszCU94XAJg4Sr2x5/iksbWcHEIMrG0v+xrc=; b=eBIdPu1dlG0VDL3zSNN9m6cB840iiZOKYWePAKCDOIGSz2dh7VNcU0mhxBhWYLGzUb99CX jeKIs2BwIBpH0xDg== Received: from imap1.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 5839013A24; Wed, 5 Jun 2024 16:18:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 23KFFfOPYGZoWAAAD6G6ig (envelope-from ); Wed, 05 Jun 2024 16:18:59 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id D355BA086C; Wed, 5 Jun 2024 18:18:58 +0200 (CEST) Date: Wed, 5 Jun 2024 18:18:58 +0200 From: Jan Kara To: Max Kellermann Cc: Jan Kara , axboe@kernel.dk, brauner@kernel.org, viro@zeniv.linux.org.uk, hch@infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] fs/splice: don't block splice_direct_to_actor() after data was read Message-ID: <20240605161858.w2izlcbhuixjhzoo@quack3> References: <20240604092431.2183929-1-max.kellermann@ionos.com> <20240604104151.73n3zmn24hxmmwj6@quack3> <20240604132737.rpo464bhikcvkusy@quack3> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Flag: NO X-Spam-Score: -3.80 X-Spam-Level: X-Spamd-Result: default: False [-3.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RCVD_COUNT_THREE(0.00)[3]; ARC_NA(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_SEVEN(0.00)[8]; MISSING_XM_UA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,imap1.dmz-prg2.suse.org:helo] On Tue 04-06-24 21:24:14, Max Kellermann wrote: > On Tue, Jun 4, 2024 at 3:27 PM Jan Kara wrote: > > OK, so that was not clear to me (and this may well be just my ignorance of > > networking details). Do you say that your patch changes the behavior only > > for this cornercase? Even if the socket fd is blocking? AFAIU with your > > patch we'd return short write in that case as well (roughly 64k AFAICT > > because that's the amount the internal splice pipe will take) but currently > > we block waiting for more space in the socket bufs? > > My patch changes only the file-read side, not the socket-write side. > It adds IOCB_NOWAIT for reading from the file, just like > filemap_read() does. Therefore, it does not matter whether the socket > is non-blocking. > > But thanks for the reply - this was very helpful input for me because > I have to admit that part of my explanation was wrong: > I misunderstood how sending to a blocking socket works. I thought that > send() and sendfile() would return after sending at least one byte > (only recv() works that way), but in fact both block until everything > has been submitted. Yeah, this was exactly what I was trying to point at... > I could change this to only use IOCB_NOWAIT if the destination is > non-blocking, but something about this sounds wrong - it changes the > read side just because the write side is non-blocking. > We can't change the behavior out of fear of breaking applications; but > can we have a per-file flag so applications can opt into partial > reads/writes? This would be useful for all I/O on regular files (and > sockets and everything else). There would not be any guarantees, just > allowing the kernel to use relaxed semantics for those who can deal > with partial I/O. > Maybe I'm overthinking things and I should just fast-track full > io_uring support in my code... Adding open flags is messy (because they are different on different architectures AFAIR 8-|) and I'm not sure we have much left. In principle it is possible and I agree it seems useful. But I'm not sure how widespread use it would get as, as you write above, these days the time may be better spent on converting code with such needs to io_uring... Honza -- Jan Kara SUSE Labs, CR