Received: by 2002:a05:7412:a9a8:b0:f9:92ae:e617 with SMTP id o40csp129144rdh; Wed, 20 Dec 2023 19:09:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IEe5J2Gi4psE7FiJXUyK7QPcwNZxw8ikb1+J2NZXM8zO0yDAzmIkbih/unxu0IcYUiJnhJl X-Received: by 2002:a50:cc81:0:b0:553:b5c5:359d with SMTP id q1-20020a50cc81000000b00553b5c5359dmr1213063edi.14.1703128184611; Wed, 20 Dec 2023 19:09:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703128184; cv=none; d=google.com; s=arc-20160816; b=G0vdc063M+U4oD5TM8gCXJnJv0/SntyxWkTo3xK01H4AE8qFdB8JdYqbCtdiFxweoW UqJJTl9zyGeTlQeQ4dlscuyai8xq4Oq9mMZkZDZjTdsql3nwfIFhWt7g/ydGrAoZ41+5 6lOs05K9CVjuRGkA3B6NyaXHJlCxRt4kDDJTzIlATrp2zExJw852jeSjzh5XviZiTHip fMs1GEprSl4Z/uOqEZX3D4WDf+5pQQbOlW+LY/WlsJfR7SrL9fHCSJyDDnpMGT9Qo6Zu 3ed8ZGPxWJC2Qx9oVQdT4TG5HATt131wfoNLbuz24UaIJbs7TwsKPBH6uEfkAwaVQPPs x4bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:from:date:dkim-signature; bh=lHelMyInKf7WfX7wQTfqF9xHr0eVHIk2emrhPum5PFA=; fh=J9tRb8oSmNAMPWMkgjMppEaYnvjrMor/cu2k4WOZ8/A=; b=f978z8eqjc5TXL+0xox3ij3GR8Yljj1XoQOq4t1Q+UKX7hLq8N3ay+6tGiAOatzQo4 VjXVFPSzDRiE98B1gKJd/v5ohEoNj32nzKMUYS/8pRlHgKgZXzB0FYnR7ZToB34I2o9O FF6oGgVYahhc1+uLpY+ZVG7s//LWJ9XKCBUnseNOM6NT9az2gmz3A8rU1FOl5202FB68 VuxuzGCpbg0y2sU3RRS7+yGBBySXdIxgYoiX8ygBbS/cyjHS+5rhkeSoHkqLlKiBmp9B C7vGGV+Qg4DrFZqwTAw3k/F41OwrLm/0PYsl8Whwzrl73JweMN9onTkrIG/Di4lvkgMt Dosg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=dSrYc8hG; spf=pass (google.com: domain of linux-kernel+bounces-7775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nabijaczleweli.xyz Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cn15-20020a0564020caf00b005525f3a6784si415501edb.146.2023.12.20.19.09.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 19:09:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=dSrYc8hG; spf=pass (google.com: domain of linux-kernel+bounces-7775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nabijaczleweli.xyz 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5F4A71F244DE for ; Thu, 21 Dec 2023 03:09:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3070B654; Thu, 21 Dec 2023 03:08:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nabijaczleweli.xyz header.i=@nabijaczleweli.xyz header.b="dSrYc8hG" X-Original-To: linux-kernel@vger.kernel.org Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03422AD4B; Thu, 21 Dec 2023 03:08:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nabijaczleweli.xyz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nabijaczleweli.xyz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1703128132; bh=eAEZKuHticwVYxrh9ppCMct1OB8vV2MAUTSowqzWAZ8=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=dSrYc8hG+4fSy0WFWd9aZsqSwDNE4gGjB3V5Qw1jR5c2AUkMmUdNDUVzE1Fe9+45G y//sDt54gWQYIvIR/B5mXHUKki0Ca2X4hMpymSj+1073lc8INhpYVQpbAw6bISFAOA 92s6NHFQw/rg3Prjt9JAsN4UgZf6L8ELbsPCO53JVe4cbsssKs19jqzNYtrLmOI6Hc y42k5X73W9gUZNZOMYA5rCn2UwZvfJvAolnMdhdAyYLek71D24c5TqS5XjvYCbUY0L cDXTpFHzEvxJVo9G7A7vG3DrM5zAaez2GiIKUUPOvnxXjMPSvVzAuaIG6jQvb+q2Oa H/aURzGp3PWaA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 15D4F13DB0; Thu, 21 Dec 2023 04:08:52 +0100 (CET) Date: Thu, 21 Dec 2023 04:08:51 +0100 From: Ahelenia =?utf-8?Q?Ziemia=C5=84ska?= Cc: Jens Axboe , Christian Brauner , Alexander Viro , linux-fsdevel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kuniyuki Iwashima , David Howells , Alexander Mikhalitsyn , John Fastabend , Daan De Meyer , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 02/11] af_unix: unix_stream_splice_read: always request MSG_DONTWAIT Message-ID: <8309aff7e55f0c7fe973bb2d1e6b6b3a80ac5a99.1703126594.git.nabijaczleweli@nabijaczleweli.xyz> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="v7y3y5g75dijoqbs" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20231103-116-3b855e-dirty --v7y3y5g75dijoqbs Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Otherwise we risk sleeping with the pipe locked for indeterminate lengths of time =E2=80=92 given: cat > unix.c <<^D #define _GNU_SOURCE #include #include #include int main() { int sp[2]; socketpair(AF_UNIX, SOCK_STREAM, 0, sp); for (;;) splice(sp[0], 0, 1, 0, 128 * 1024 * 1024, 0); } ^D cc unix.c -o unix mkfifo fifo ./unix > fifo & read -r _ < fifo & sleep 0.1 echo zupa > fifo unix used to sleep in splice and the shell used to enter an uninterruptible sleep in open("fifo"); now the splice returns -EAGAIN and the whole program completes. Signed-off-by: Ahelenia Ziemia=C5=84ska --- net/unix/af_unix.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index ac1f2bc18fc9..bae84552bf58 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -2921,15 +2921,12 @@ static ssize_t unix_stream_splice_read(struct socke= t *sock, loff_t *ppos, .pipe =3D pipe, .size =3D size, .splice_flags =3D flags, + .flags =3D MSG_DONTWAIT, }; =20 if (unlikely(*ppos)) return -ESPIPE; =20 - if (sock->file->f_flags & O_NONBLOCK || - flags & SPLICE_F_NONBLOCK) - state.flags =3D MSG_DONTWAIT; - return unix_stream_read_generic(&state, false); } =20 --=20 2.39.2 --v7y3y5g75dijoqbs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEfWlHToQCjFzAxEFjvP0LAY0mWPEFAmWDrEMACgkQvP0LAY0m WPFwKhAAo41u1QzR/jF+s5GRQX+lH5PM1qDFUNRtKYaqEW3TAkZX9dacRh/mj/w3 Ft/oX+Prl+XffMC9Ysnw2xxmpdnOiOEDZHTCuwI/w53Iymv7IUZXjvMQfPlW5ZdY nnefkBoguNC8jvynt4bHAALcmNWah1cNUSmiGH8NVJWIz6dLwsRiJH8DcZjvmmXt P5hYvFizVmZqDpJaSd3MzyE14qBl3mrEQ2LvNeH5kEmw7yoeeugayk7AcS6ixqsg fF8TwkTdm+D0me7i544z+HRBfW3xnP23ulkM+DE5Boi+WTtZHn+Di4/2rdqwrs3Z bPYR4SlQIesMjDihHjZBMmj11S3/JwJ03E6kWLw/FoFQKyNA2gY88ky867GMZ1/v /ZbnfhqPq0BAeEks+Pj8tzEt1nAaGwWk2YIMEMInJR2qDqpP+UFdakP69PbOlcp2 YXwzbxkod42UTVPRdB4M82nsgLxV5elyVxg12fAEXavQ7bYV2JdkxHdTqqW954JD T5FAd5GHlkCtcG+HYv+UPY7EWlgQI0Qc/6RBaoYdKLystZq1RpBWvZsjxv0bXQG5 K4my9r0laEVNCaOeQAwzo8K5jbNSyEVodmHukqPki95nqxaWB/nwSUz59vSVPYWt VfNrXnZfzd+Ss/j9CJk0DKOJHMJzTwez+CdsuZ+Xd5yEy4gjdzk= =EAl7 -----END PGP SIGNATURE----- --v7y3y5g75dijoqbs--