Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4534455rdb; Tue, 12 Dec 2023 02:13:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5QI3bpoMq4teT8ANQUBjMb+83GKWUA0+it9kQOne3w6D3DsrVXf7/tfQJXIKlkLHAgAjA X-Received: by 2002:a05:6a00:1d26:b0:6ce:5bf5:60f8 with SMTP id a38-20020a056a001d2600b006ce5bf560f8mr2623371pfx.58.1702375990995; Tue, 12 Dec 2023 02:13:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702375990; cv=none; d=google.com; s=arc-20160816; b=BJDATj2EVnZtEHZTXMKu+EdVu8EIVQxL9EVchkYsXAqomqAvNWpQN458PkWc8Lwdya UWLRHqVRTi/Y7AjORKWQcTUUX5Axq+V28eDknWcRVpv4Cx8pot9PiRBwEDypCKwBuXGE HfhRigEMMXPisYHBapw220wT8+eme/6BqS0kaqJg724uBtZz6YRdS3BFXvjNuO5qGOx3 agAX0vSIz8dXsrVjl3MGoBDxsbxDMjLDPaGP10XxrZhJoLGWYD41aPyjvMzZeYJ83K3O p9kRBn81KxlC9gdhuobwKdjQ5ltc6ipjmS1m4w1t9/vUMlp/ai/4Lb9IXStf9Qz2AoFt duYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:to:from:date :dkim-signature; bh=4hxzCj/pB+6qdYAPKsT4jHqQl6twbw/dd9QSn80um2M=; fh=fi2GXeEH2RMshyuG0DfCuvmc+bmbbfvakIDlzZ25MD0=; b=YwN72NLvoS6nhscDZLYtkzHC7vU2nA9ljafrLXbokZtwPNT7TS3KcNmRyvMipEEfFO VKcMFw53c2Qu54e6mP9GjpHYXpy41lUeKue5OyRpWE28PNZQfGBhb5eZBmb7xMz0ppnH Xp6TvWJEmNjhjT7SFgCfsfY8BPM3KqZ0cZ06dyxkYIscdCrA+/gWCDSNUWmpDlwEZA5t XUxQCpLj0jl0jjp/yFb5M2YjIQAgfeAOSmHCIJClinLjyioyKho42M8V8AWFDDF0LVlo du/PKUHRuT3wsKGdstdrD9tMUnb+1w+3S4zqTu/VvkDvjIxGPom9jB2QzAOcSjs0w40J u9XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=pw6XLXic; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nabijaczleweli.xyz Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id y18-20020a634b12000000b005c65ed0f692si7497130pga.141.2023.12.12.02.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:13:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=pw6XLXic; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nabijaczleweli.xyz Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 8395A80A1374; Tue, 12 Dec 2023 02:13:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235025AbjLLKMl (ORCPT + 99 others); Tue, 12 Dec 2023 05:12:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232073AbjLLKMi (ORCPT ); Tue, 12 Dec 2023 05:12:38 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E900DD9; Tue, 12 Dec 2023 02:12:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702375960; bh=g8iY2h+KeEWIRzD4R4jVgCFkjuQjTUqXcpcOACu7ias=; h=Date:From:To:Subject:References:In-Reply-To:From; b=pw6XLXicnVg0zWWuIVngs44b7T+SOpKSunQd3is3IrR5tTKNZGmmpy9Yx+FpMDau2 cswcXbe/DwtzyXjJ+tsb28zfFjJK40Iagqxp7u28lPMetPsSmwb63ZA20QwbbfQcNC 1k0IDx5QViMTv8h4bi6fAsRvvZS72h4dxPOeXt98Tm9bDl0Cym1lH1o816JxSA9I++ 8GvhgjNnVLmKvxlOyFe6kCepgsv7GxaCp8nhCRwoR9mqZWwfd5vbDJ0Za2h4WJ/TRb /2gpXn0nQM+Fi0SFzksbTGyToscNDeoEp/OTc4I3AU7OSyc70MKx48A2Kzna+oVM2J 7/f4EQb0B60gA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 5A2A912A7A; Tue, 12 Dec 2023 11:12:40 +0100 (CET) Date: Tue, 12 Dec 2023 11:12:40 +0100 From: Ahelenia =?utf-8?Q?Ziemia=C5=84ska?= To: Miklos Szeredi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 03/11] fuse: fuse_dev_splice_read: use nonblocking I/O Message-ID: <1b5c5b0a18a59ec31f098959e26530ff607a67379.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="c6tynwv5x5dyuh4x" Content-Disposition: inline In-Reply-To: <1cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:13:04 -0800 (PST) --c6tynwv5x5dyuh4x 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. Link: https://lore.kernel.org/linux-fsdevel/qk6hjuam54khlaikf2ssom6custxf5i= s2ekkaequf4hvode3ls@zgf7j5j4ubvw/t/#u Signed-off-by: Ahelenia Ziemia=C5=84ska --- fs/fuse/dev.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 1a8f82f478cb..4e8caf66c01e 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -1202,7 +1202,8 @@ __releases(fiq->lock) * the 'sent' flag. */ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, - struct fuse_copy_state *cs, size_t nbytes) + struct fuse_copy_state *cs, size_t nbytes, + bool nonblock) { ssize_t err; struct fuse_conn *fc =3D fud->fc; @@ -1238,7 +1239,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud,= struct file *file, break; spin_unlock(&fiq->lock); =20 - if (file->f_flags & O_NONBLOCK) + if (nonblock) return -EAGAIN; err =3D wait_event_interruptible_exclusive(fiq->waitq, !fiq->connected || request_pending(fiq)); @@ -1364,7 +1365,8 @@ static ssize_t fuse_dev_read(struct kiocb *iocb, stru= ct iov_iter *to) =20 fuse_copy_init(&cs, 1, to); =20 - return fuse_dev_do_read(fud, file, &cs, iov_iter_count(to)); + return fuse_dev_do_read(fud, file, &cs, iov_iter_count(to), + file->f_flags & O_NONBLOCK); } =20 static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos, @@ -1388,7 +1390,7 @@ static ssize_t fuse_dev_splice_read(struct file *in, = loff_t *ppos, fuse_copy_init(&cs, 1, NULL); cs.pipebufs =3D bufs; cs.pipe =3D pipe; - ret =3D fuse_dev_do_read(fud, in, &cs, len); + ret =3D fuse_dev_do_read(fud, in, &cs, len, true); if (ret < 0) goto out; =20 --=20 2.39.2 --c6tynwv5x5dyuh4x Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEfWlHToQCjFzAxEFjvP0LAY0mWPEFAmV4MhcACgkQvP0LAY0m WPEj+A/+N0AmpH2RP6YlzkjfUWBbbwk04r4Kt2Y5qTL4VYmxKV2oZrtWgxGgi9ku 4eNXhny1R3F9yqovwQXQGPSMHPMfbHR+ggMeY6K+prItZKRmCrMSdoXwEl+4Fp8S LMb6s1h5DCkJh95bjJAgDrlEJPnKWbRPtxhPBbJQ0asAYmRnOJ0w0LOFOgk5opi0 jwA+sG5TaIYGl4SCJY1fyUFBaQJxaaV+d//BGf8545m6Eq5maBSxE1YEtz9rJI6g tKqUJh0cMB44wJSeML06LxWOswgW2iuCfce5ReoXHoLBqFuJRjxL3WUW+AAszua+ V08khpYZrT0X5Mp7B5oXKHjqDK8qOGY4ZyxmfGmMZvAHZsoJv4qdxsB9DCmuNRfF 2qx+dBXwbiUXkR0wKwH8ItfSLCso4gTL8LjaE+aN4C25zVWDbjUwAfj/pEMQImwL JRCva7NGBTG7sRo0ABbAsXPrL9h6AW/ParE6uEuOQlNaj7tEDEQN8IcO+v/Xk67m Wh77SaYkLGQV4T3UZF0gzjiOZeTqP4DO9C28HNvTGJT9OiOsMIHUUf/ko7UBo+Fs ZlptXlT2gJ7s1S+ONVTxerxcOZhdW4jW6LiOtm0j6n18E5MDdrTMPnN5LgoZRcIx Z+0V4zb2qv7QALW//GnmehymjhUJb/Kh7vRenFtQRvpOzUBoq+c= =ANlq -----END PGP SIGNATURE----- --c6tynwv5x5dyuh4x--