From patchwork Mon Oct 16 20:35:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 153744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3711484vqb; Mon, 16 Oct 2023 13:36:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHuFG7aBjBsTf9q0RhHrcz39IbhFCDd365oND0g4z3z4xwiNhyOjdA7FflezYS+Lkv3ubKq X-Received: by 2002:a17:903:290c:b0:1c6:2902:24f9 with SMTP id lh12-20020a170903290c00b001c6290224f9mr424591plb.1.1697488565045; Mon, 16 Oct 2023 13:36:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697488565; cv=none; d=google.com; s=arc-20160816; b=A2Xcgg+vswBpKvnbT90jOvQcNiVkLjBAGwK8/FV3qcOAWLmZyn50RW4wqelxhqN277 YTdUFzQOkUrPigdK5vNfjU6qHRx7qkY6Lo0caUTYDBvQ7POv9zU9ptPFUcxfQpAMzMLU /T1bLUVSuADtpDdnBGBuz7i7TDHKEn8KhhMZaOmlFZzUs21MTpyeN1qDf57CEDD8zpA9 VQqNZJ1LMNtbBVn0iKShxkbrsc2qMBlP4RfRQSxxbpCUs65qljhTcHGu7v8Js26BjhwF GCf8fQQJl0O4PKXVlbSsGJeup4h01RRSS+QXkfkoNLlQPiEHzI0GxTQq3CQVdJOhd6qX BA8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=LUkO08QFdMGYAkxVRZn7tBXVRIVroY00ER7dOpVVwWs=; fh=Oskmylf92gQgoWcJVK2DZkdbYki3SlnV/gEzpmChMXQ=; b=kHAYNZ6IPr0Z8ntegZEUwZVCguRg+AFTRfT2EVSE6Yif6UHuWuk7AQa48kqSCIlgoT AYEQkjLmDeVGTk8Lmb731ovC4+taJw/RCjU7Wxj3iabUguchktdBhfrbDew5WdxyXrSb E/dSsxRagVTwSa6ct5U/izh7gCUexHl1Fqw9VTHYjeki7MK4nQimlXkJAucRge0SNz+W Z8PzpPVKjX6Fgy/MMjFFeW84fiQseka7jNkbze3bzxbPOQoVxsfWgCnA1nqfK7PZMgGQ Ow82bQ8bIjL/ig+voYDQLaDacCh10IXNPhmfWYnEll2i4jP95MZi8YsOgzrNtQpMO77z OkAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=C90GcxUM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id f15-20020a170902684f00b001c46467a211si105282pln.193.2023.10.16.13.36.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:36:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=C90GcxUM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id D0DD18041C17; Mon, 16 Oct 2023 13:35:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234170AbjJPUfs (ORCPT + 18 others); Mon, 16 Oct 2023 16:35:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233280AbjJPUfo (ORCPT ); Mon, 16 Oct 2023 16:35:44 -0400 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12A5F103; Mon, 16 Oct 2023 13:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1697488537; bh=Alm3zmAVynjk8wk0prJ+3hHGU0F6PYlx1LJH0af40nw=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=C90GcxUM6lHvAoH/AV87Tw0bEuMMpniry7O2C1sQXd2Ss0UcHJDrMIz+A0VTmZ4+i WrM1fIAWn3ZGFsHF+CG7BRXBXoV/cB/OTlCrlqyfioSxLmDK4xXrwGWi0+rsry14AH otEtVRC4SPvlxKLDqTtwwwmtqFWSL7aWEnVTbdJ7K5vdxyoEX3iJFY4iQtA4RqqQzi c6hhcKuoUx7aHL7GoJYj1oMcBpDBRwmkkGTDqrjd2YGBLtY069IrnDwj+eQwu4Jn9+ bs0v1rDRKY5BuMIHAkjGE8L0/VsvX2nZ95w9uoXb6Yx1CFK6QJIGp1/34899mmG9iG RHHBFrY5ounbg== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 3EADA10406; Mon, 16 Oct 2023 22:35:37 +0200 (CEST) Date: Mon, 16 Oct 2023 22:35:37 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/11] splice: copy_splice_read: do the I/O with IOCB_NOWAIT Message-ID: <9910c8026500ba43f3d93e66e822ae64980d9527.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20231006 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email To: unlisted-recipients:; (no To-header on input) 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 (pete.vger.email [0.0.0.0]); Mon, 16 Oct 2023 13:35:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945769419789839 X-GMAIL-MSGID: 1779945769419789839 Otherwise we risk sleeping with the pipe locked for indeterminate lengths of time. Link: https://lore.kernel.org/linux-fsdevel/qk6hjuam54khlaikf2ssom6custxf5is2ekkaequf4hvode3ls@zgf7j5j4ubvw/t/#u Signed-off-by: Ahelenia Ziemiańska --- fs/splice.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/splice.c b/fs/splice.c index d983d375ff11..9d29664f23ee 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -361,6 +361,7 @@ ssize_t copy_splice_read(struct file *in, loff_t *ppos, iov_iter_bvec(&to, ITER_DEST, bv, npages, len); init_sync_kiocb(&kiocb, in); kiocb.ki_pos = *ppos; + kiocb.ki_flags |= IOCB_NOWAIT; ret = call_read_iter(in, &kiocb, &to); if (ret > 0) { From patchwork Mon Oct 16 20:35:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 153747 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3711663vqb; Mon, 16 Oct 2023 13:36:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHmFS1IF63/TKi2TiYMnr1lvxNYHSw8iUmaKwyDLk7S/Kg9ZyqJKWPQdOY6FkHoWFSiRSOF X-Received: by 2002:a05:6358:9fa2:b0:166:d93c:1c47 with SMTP id fy34-20020a0563589fa200b00166d93c1c47mr390002rwb.0.1697488585505; Mon, 16 Oct 2023 13:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697488585; cv=none; d=google.com; s=arc-20160816; b=ijYd1Vh9CpvgMaEHE8S7Hzsi7Y6qPwYdUk6rwzYhkFrR0K6htd38IjnMGgisvz7Zk8 JkJh6arpTA3PmhDsZ5IWFnFzP2nFJF9UEAqNQnqUud4iVE5HLjXPTUFqzsz9NPT95KQf +gI9+LSknSJowdrnRf5kAfHKT6qv3IfPyMs084o3mvewlScPaQbVmRUmCZ9ZDUkfpmvB 4jRvzhn4XR7MYuddr7Qb6u5+euchskesXpJZcbuvtCz60/MO1mn6xeKLaa45h5rxsU1E rjl7sbNjJtgwwOIc7yM0y/75QfYNeJppI8p7aB0iG1n/3Bv0IP4lViwL+0v3ClOH/Nxh 85fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=SRefprY6yJ5tR72xexTgLZXUPYS4P+5XsrKDsPMLGUM=; fh=f6HFdZcA60n/XG/EpAejijSP9wEAg+RXoH4FMOyV+cI=; b=I8GIFlpIQ5ACIGw1Ts07ihDj6GvVHC+5uMWif8dG9TfsU9zXB/zOYsVruESjB9ymYm 5F+Udx6NtgxqJDvx4gRPZ0MzOY9jh8tNTwYOUVfxHpjPHZT3LfbVXQdu11O7ruXD1WHO b5KW1G4G+ZdZtN6uMrQpFXkIFwqX4bN9SyW3cZjlQEHd1ph/Bw9f0AqTX+0Cu1QQLiaD IPMy5C3tQjYTkUzEdZfFiGlVQfdddt49g0g+VI9btrhnM54MmnG7rSW4LmML/GXyFWMA 9kQbA5G77Fv7BpLHALTo+AtSiwRtYmFoTAjRzoyCeJRZ6UYm2ENsTcaAfOAKA/MZEm5L LRdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=GWQMVXQZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id a129-20020a624d87000000b006b864485166si544141pfb.146.2023.10.16.13.36.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:36:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=GWQMVXQZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 27B0680BCBA5; Mon, 16 Oct 2023 13:36:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234181AbjJPUfv (ORCPT + 18 others); Mon, 16 Oct 2023 16:35:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233732AbjJPUfo (ORCPT ); Mon, 16 Oct 2023 16:35:44 -0400 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF85CEE; Mon, 16 Oct 2023 13:35:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1697488539; bh=QIdiucrS3GrnXntvusWAnMhQFbLIMZWpsYTEgA0oZvk=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=GWQMVXQZ7y/HbCSGTSv83Wr3yTwhc+socxhzXVipZsxtx0T8JcxosbyMpIp3Lf8z7 JGKoumBA2EtRQkMukTFZR1ov6HnSh6vAOMfSSX8Qv3NG3x0SzdEfL6op9BJRNlrdit 8AE/gWj3NaT4wXWPw6kLwuuTLlvYsWwsqJPB4zMV8Ip+Gi8BNEAOdGvGp8rwKnnHXn fIUROjStWO6J0jfFr/Y5Z/t9Pl4LzAySsoxK597OsUEHrgCxdr3Eao51iJp55Bdz4J GF+q0YcnRS+Wrlqvkd6H9r/Figdls5+HeYs79FtkCRMTC4O7V3jlWQmzwQZRwL22hs GwkNuU8yyzSjQ== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id D38D610408; Mon, 16 Oct 2023 22:35:39 +0200 (CEST) Date: Mon, 16 Oct 2023 22:35:39 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kuniyuki Iwashima , David Howells , Alexander Mikhalitsyn , Kirill Tkhai , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/11] af_unix: unix_stream_splice_read: always request MSG_DONTWAIT Message-ID: <8db45d00902da22ae25aa16a0c28bb41002fc039.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20231006 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email To: unlisted-recipients:; (no To-header on input) 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 (pete.vger.email [0.0.0.0]); Mon, 16 Oct 2023 13:36:20 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945791184450762 X-GMAIL-MSGID: 1779945791184450762 Otherwise we risk sleeping with the pipe locked for indeterminate lengths of time. Link: https://lore.kernel.org/linux-fsdevel/qk6hjuam54khlaikf2ssom6custxf5is2ekkaequf4hvode3ls@zgf7j5j4ubvw/t/#u Signed-off-by: Ahelenia Ziemiańska --- 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 3e8a04a13668..9489b9bda753 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -2889,15 +2889,12 @@ static ssize_t unix_stream_splice_read(struct socket *sock, loff_t *ppos, .pipe = pipe, .size = size, .splice_flags = flags, + .flags = MSG_DONTWAIT, }; if (unlikely(*ppos)) return -ESPIPE; - if (sock->file->f_flags & O_NONBLOCK || - flags & SPLICE_F_NONBLOCK) - state.flags = MSG_DONTWAIT; - return unix_stream_read_generic(&state, false); } From patchwork Mon Oct 16 20:35:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 153746 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3711653vqb; Mon, 16 Oct 2023 13:36:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhEW0d8OQTUbIhlnUzAjIgjmZd39f445MYWj8eZYhJDfUDK/3X9lM8MKLUkgKZYPbq47xp X-Received: by 2002:a17:90b:4f88:b0:274:99ed:a80c with SMTP id qe8-20020a17090b4f8800b0027499eda80cmr258116pjb.3.1697488584493; Mon, 16 Oct 2023 13:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697488584; cv=none; d=google.com; s=arc-20160816; b=lO0Q/eMHinAILDxm3LMMnndtcjhvhW7Rpdh+ySK79gYnYG5FhNSWjZpFVbFUT+xl0r AEjTesvcUH9OCLAU88okTowLPlscc3CRVm3wJRCqyw6W19Qm3wRSR71XvtNY0nF3j2vM HEKZun9PP9D2Gji47MOtr6tTVtx20Nk2x0S61rRuJ9T5K0p4/1scV2KFo3KfWnLB/nB0 oq8CoBm1E0mf9NXhhhytB1jMPaGrExeYXQd+6D9VtZjcrZ3eL/5wjrXrY3fgifAYrQE4 Er12H4ZuaTL1eK1plXFD6jLHiTzdNiQUe21SHDeKox3K3szycsn2ugdgkRi1bfXJ8JJ/ DCfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=urP1Ge+cBUzMygeAwHlTw67O6rG/d/al/ck8jxSU2mU=; fh=62wK+4pIBX0uZ4H9yYD6sp3wf36By4a+mC5zDIJCHp0=; b=tECu+hf/Yao/FNvGS4Nrw+MW2dJuHSp4xSZwkzqMY6/ggpW6WByLCWFA/bHdytHK7e LTbOlrkhHALrn/QJi27liH71Rq6oYm25TL2t3aaKh4zW0kA+A1qTUj0nCzT3RdVQjgs7 8VbkgUcgTQRwNdrV0XhDjZzsubfjphU6qBvwqcR9vtrNeskUVmwoQo3VZWpllXWiMKRl WtLOwRLljweOn2sk3q/KLSUnDXUHPduPKA4zh1NyFmDme3rhM4Yq+YrqA18KRK93gDK2 WZ8xfE7sNrz9iQrjCSoLv1yU8avBJ1oRAqmz3iRDa5RGWxBY1ovSL6mDKuXXbAMh8946 op+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=FDxSK7+q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id 23-20020a17090a005700b00276945c92c1si65619pjb.36.2023.10.16.13.36.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:36:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=FDxSK7+q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id B755E8039571; Mon, 16 Oct 2023 13:36:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234198AbjJPUf4 (ORCPT + 18 others); Mon, 16 Oct 2023 16:35:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234165AbjJPUfr (ORCPT ); Mon, 16 Oct 2023 16:35:47 -0400 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A4FFF3; Mon, 16 Oct 2023 13:35:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1697488542; bh=NRbNKQIbqXwdFI6cLSPVAS/zA6d+h5GOKJtPRmfoW1I=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=FDxSK7+q7Lv09vsL8pwbGb9kZulXuWLSLcMHJqbOLfGi3sPDBv8k3fZEPTkVFjsnV kg0uWcEDp+AS88dUZtq+5FB2Oo6s3r83e67FdycNGsOVssbG5ORlkHWf7Kr6s/1iKy LJXB1Mi4I2HZpqKc+3SDmOUw7ppNORSGrCtraFoCus5ZBX1t5E74VPabdeJNP8prRZ x5u/KxdG3/8pWLlJ4NiImWdEbZWl0qtAmGSWKP75IXEIyyVSCyOQZubiI2iukhk2yi PwIiXZCHVvzuciffqB3bmWj2IKRHFB2FKFaPkwgEnimH4KV1FQPzLZ3yOlHr1qbFhr bPASMjVSgsixg== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 98D861040A; Mon, 16 Oct 2023 22:35:42 +0200 (CEST) Date: Mon, 16 Oct 2023 22:35:42 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Miklos Szeredi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/11] fuse: fuse_dev_splice_read: use nonblocking I/O Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20231006 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email To: unlisted-recipients:; (no To-header on input) 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 (lipwig.vger.email [0.0.0.0]); Mon, 16 Oct 2023 13:36:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945789804435051 X-GMAIL-MSGID: 1779945789804435051 Otherwise we risk sleeping with the pipe locked for indeterminate lengths of time. Link: https://lore.kernel.org/linux-fsdevel/qk6hjuam54khlaikf2ssom6custxf5is2ekkaequf4hvode3ls@zgf7j5j4ubvw/t/#u Signed-off-by: Ahelenia Ziemiańska --- 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 = 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); - if (file->f_flags & O_NONBLOCK) + if (nonblock) return -EAGAIN; err = wait_event_interruptible_exclusive(fiq->waitq, !fiq->connected || request_pending(fiq)); @@ -1364,7 +1365,8 @@ static ssize_t fuse_dev_read(struct kiocb *iocb, struct iov_iter *to) fuse_copy_init(&cs, 1, to); - 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); } 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 = bufs; cs.pipe = pipe; - ret = fuse_dev_do_read(fud, in, &cs, len); + ret = fuse_dev_do_read(fud, in, &cs, len, true); if (ret < 0) goto out; From patchwork Mon Oct 16 20:35:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 153745 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3711637vqb; Mon, 16 Oct 2023 13:36:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwoNPlYIkGlAZgR4Zb9a+VNNnF9nnvAm+mHAWrHdXA4MJXlWh/KbgIRt8ggsDMNCVHlOJ/ X-Received: by 2002:a05:6a20:7d97:b0:171:947f:465b with SMTP id v23-20020a056a207d9700b00171947f465bmr156628pzj.4.1697488583191; Mon, 16 Oct 2023 13:36:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697488583; cv=none; d=google.com; s=arc-20160816; b=mBeJL9A8HzMuEDUjwN1MYfkCGvmAw7zF0hmtxRxse6x5bacL1hEL4XuT9lMRdZu2SJ SiM3EtmSyQ9eVBy8A+GlpZ/JcSNh5337DcND8uGD6VKZrqODJ0ZGW1AWy6H4lb/wTRCG NHu9dy7wSV1jimx+BBW0RVL3BcqmbCtfoyVOhgQERnMWCBWUwQbRwarqkNZ7JZBTw9/a vJ/A0LN9MPGol5ZyiYjbJ/wLUgvrWmwZzGyu02WMkiv9RzTD7Bnd7mdR5qJ7MObM3PWB 2PnLR1g46f5NcfGLTpVQlV3NnsgMY8w/NrxuBHE1z1APrtLojT6fV8AcIRiLhhSGHTQM A74g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=YKPitgPfPq+enqpAhjulifAKJTaGk6hbgXxpmCF/sPI=; fh=LbhcMvxDWaQMcejnISYoKbXQeUyc0Fef25lCiTI5iUQ=; b=UqeJv1xdwY2hwhcv27BYPgM1ziFtQ3FLaURsMRD80mBI+No99dprtAfHpl0/dLb+Bq /XB2l79QA/NT8WEM7Y8Tjp/5AzXrBjRKK9l/w80WYBC2zxD1EnushXvgfqWMPgj4h1/r 6kKSbhsJmiy0mOD68JvANO0VfeVt1yXgrLzo1rc7Yk5jwdMVOqP39VhZGoDjYTe7pJ54 Iu8ORzIOrJVOGH2v+Dv9p4WEuviRk51fQUfvunZdGbyyHQMmtBLpPpFPMYAcAZMyaycb VPhtZRlAq0e+Sb7UtWIb9avYORnI0q4kxtdBaJDJO8CW1x21hfj2EP/fohbLoMwxTs2K QShg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=jYyfhEbJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id a63-20020a639042000000b005b7dd1d190asi99511pge.263.2023.10.16.13.36.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:36:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=jYyfhEbJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 8117C80BCBBD; Mon, 16 Oct 2023 13:36:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234164AbjJPUgF (ORCPT + 18 others); Mon, 16 Oct 2023 16:36:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234210AbjJPUf7 (ORCPT ); Mon, 16 Oct 2023 16:35:59 -0400 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EE35F9; Mon, 16 Oct 2023 13:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1697488545; bh=M3/tVO1jPiOOO1Rw82ko0E0+3twLTEqXefGMw9ogJ9c=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=jYyfhEbJKEMbOcqostzxf+q73l4ZaJN6lOf9bdtVSWBOPf+msOlGFpNFJVUsC6+QG 4wJk7QZj/bAAHrNWwhLZuaEVwhM5Iau+GJ3ojMT0KmcjbZoVDP8Skr8cgtWqiuJHNN pMZ7Lvlf8sfXBY000Uy1ucYtx/WVcKldmqPDCM1xc0Ewjiq3/kxnKcdUStKYsI5EZQ g1tOMXu8arK3rnoQylY8ZPA5AvYphy71K/rwO1J1Qs3jVbucbNUusKHp5iPIlf3PZP Ten/sO9sDaOD7Sh0aRYfwshmiwXykfQDyItYBVGMYi+QjMKL0/38X1D1bhgw/zCn5S wXaLEXXF1FoVw== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 4B34D10410; Mon, 16 Oct 2023 22:35:45 +0200 (CEST) Date: Mon, 16 Oct 2023 22:35:45 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Steven Rostedt , Masami Hiramatsu , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH 04/11] tracing: tracing_buffers_splice_read: behave as-if non-blocking I/O Message-ID: <1b84f2e4e5eaad501ff7b2bb03e2ad2f25ecdf14.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20231006 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email To: unlisted-recipients:; (no To-header on input) 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 (pete.vger.email [0.0.0.0]); Mon, 16 Oct 2023 13:36:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945788622854908 X-GMAIL-MSGID: 1779945788622854908 Otherwise we risk sleeping with the pipe locked for indeterminate lengths of time. Link: https://lore.kernel.org/linux-fsdevel/qk6hjuam54khlaikf2ssom6custxf5is2ekkaequf4hvode3ls@zgf7j5j4ubvw/t/#u Signed-off-by: Ahelenia Ziemiańska --- kernel/trace/trace.c | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index abaaf516fcae..9be7a4c0a3ca 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -8477,7 +8477,6 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, if (splice_grow_spd(pipe, &spd)) return -ENOMEM; - again: trace_access_lock(iter->cpu_file); entries = ring_buffer_entries_cpu(iter->array_buffer->buffer, iter->cpu_file); @@ -8528,35 +8527,12 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, /* did we read anything? */ if (!spd.nr_pages) { - long wait_index; - - if (ret) - goto out; - - ret = -EAGAIN; - if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) - goto out; - - wait_index = READ_ONCE(iter->wait_index); - - ret = wait_on_pipe(iter, iter->tr->buffer_percent); - if (ret) - goto out; - - /* No need to wait after waking up when tracing is off */ - if (!tracer_tracing_is_on(iter->tr)) - goto out; - - /* Make sure we see the new wait_index */ - smp_rmb(); - if (wait_index != iter->wait_index) - goto out; - - goto again; + if (!ret) + ret = -EAGAIN; + } else { + ret = splice_to_pipe(pipe, &spd); } - ret = splice_to_pipe(pipe, &spd); -out: splice_shrink_spd(&spd); return ret; From patchwork Mon Oct 16 20:35:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 153748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3711668vqb; Mon, 16 Oct 2023 13:36:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+2gMNAhhW1o7oLsXDX+TBC28K8YtGZ2IJoogJBz3Pr4+O8IABhVmyIyJb1W3/ERwh/57m X-Received: by 2002:a05:6a20:c182:b0:13d:fff1:c672 with SMTP id bg2-20020a056a20c18200b0013dfff1c672mr140467pzb.4.1697488585956; Mon, 16 Oct 2023 13:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697488585; cv=none; d=google.com; s=arc-20160816; b=JscpXxbZRTJxRZE9pwb5nKXAW6DW6hOhNLTDi0tYDCLEEvqpii3ZZ+99N8KxzYb+UQ zWKww9Xsg1pYefmaRumsYfj5dDIN4l2hzVP3QQxpul/KfTNQFRcVHuqZAol/5vF4ZRas q9PzgA/u5p4VwnX6u16OcZLbkC2zD0AGFRmoTKXgtAk07l4kM4tUBgynFgerKXza1mIU GBUmyYcEgF6buCMLJjQfLU04HSCvieEPoTHfAtBKl2hBxu9B/ZmvTAoV4f53ndEdocJ8 lc0waAU/krEw9efVwx3Bp2LGHu3/H6FG0Mc4aaW+4AXxQ+17VOHZmaiS8VA3rs1S+nnk Tp9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=OVgZ8qSxw7ctC1lItSIRvXZLIeEVkvf+UczY6Pev1qw=; fh=TWGmj1uUuQ2Z68kTkEF/Iq99wAblF/0MS/Hplf/0o1c=; b=JBmQx8NJXTc1puI2sLgwn1buUSHA/RA8NxqUKaGOLC71ccQdPG1XG/ANGseGL5Avbc L2aDld8RdBJuIv9YcRF5NMm9/c2i8DQbiOPr/tbWfHaUdc5Ia6eW0BTMI3mDwqL2UVBn yVxnWPGM2OO/5jn1luZnnw0lW+RvXD9MhdaUD7nBBbfbort+GawuXpvDs+iLjk65t284 HkodoBi0tgkAGn8r7WMwnpTkemSWXaVQuw6IpT86BzFl0csNvuBk8/1TBVxwcAC6fHtI Rug+VNk6HOdiWH7YPXqhIQPhy5SYjHkS0wVZJhEoR0FPEPSYQtl5NmlkoZn/VuJuPDxu B2ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b="IPYJ/UOZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id p2-20020a170902eac200b001ca85dc8815si111204pld.97.2023.10.16.13.36.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:36:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b="IPYJ/UOZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id A5089805A582; Mon, 16 Oct 2023 13:36:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234234AbjJPUgJ (ORCPT + 18 others); Mon, 16 Oct 2023 16:36:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234158AbjJPUf7 (ORCPT ); Mon, 16 Oct 2023 16:35:59 -0400 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92D2EFB for ; Mon, 16 Oct 2023 13:35:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1697488547; bh=BL2nvvqmXUiLD1k/WJxDJuoKF37Dds8amZSyjDvQggY=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=IPYJ/UOZHMjmTbBk0B4ucR9ykxebZ6gj9hCrlA67sv//yW+ch5OYd8tuQ5AEyygEo 8ccEpfpkL6BvcJrN8JKDbIlKu7kf7nQG0QPh38XhGQOYvMCgQmYyd+bh7O17U+alGT 2q53FEEmpgaqR2tOMi8sjPYvQP+UlY+zDvbCd2AYMiylE9pMej5ynHLGFfFcjp5sxH lKGc0BIOJDCHDgtOgGuhDrPMp/pLuNGE6yN3D3ktY2lmnQVvov4Zi+MQ202wvSjIs2 H1d8bgllteTwDIxS7vaGLAUjPabkkz2HqQ40DRTPrdI9HsNE2Zqcdo1UIKoJ9MZXAX aR3O0jsM3QQCQ== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id CAC2310412; Mon, 16 Oct 2023 22:35:47 +0200 (CEST) Date: Mon, 16 Oct 2023 22:35:47 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Andrew Morton , Hyeonggon Yoo <42.hyeyoo@gmail.com>, "Liam R. Howlett" , Pengcheng Yang , Zhang Zhengming , Xu Panda , Li kunyu , Gavrilov Ilia , Suren Baghdasaryan , linux-kernel@vger.kernel.org Subject: [PATCH 05/11] relayfs: relay_file_splice_read: always return -EAGAIN for no data Message-ID: <329ea2aecb56e982f16aea7c637fd0e8a7985506.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20231006 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email To: unlisted-recipients:; (no To-header on input) 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 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 13:36:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945791515754256 X-GMAIL-MSGID: 1779945791515754256 For consistency with the new "file->pipe reads non-blockingly" semantic. Signed-off-by: Ahelenia Ziemiańska --- kernel/relay.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/relay.c b/kernel/relay.c index 83fe0325cde1..3d381e94a204 100644 --- a/kernel/relay.c +++ b/kernel/relay.c @@ -1215,8 +1215,7 @@ static ssize_t relay_file_splice_read(struct file *in, if (ret < 0) break; else if (!ret) { - if (flags & SPLICE_F_NONBLOCK) - ret = -EAGAIN; + ret = -EAGAIN; break; } From patchwork Mon Oct 16 20:35:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 153749 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3711682vqb; Mon, 16 Oct 2023 13:36:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7hio30/tGxpERFJLLqwmCwYA1c5/474wgN1yOue0ULO6vqPlV1mlj68F6zzFSHzoeDK8k X-Received: by 2002:a05:6808:183:b0:3ad:f3c0:5da3 with SMTP id w3-20020a056808018300b003adf3c05da3mr427039oic.3.1697488587507; Mon, 16 Oct 2023 13:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697488587; cv=none; d=google.com; s=arc-20160816; b=TkNxeyVxveXwNwOF2R5PNEzMwpdTpMD4k5OAnErt/13FMyk8ZlFG9ljIg7C7eHjmiZ +ab69roblk72zLw8pk9OHbalgYhxTD/GaFED5fa/JaKpHAk0QZwTf73cZX923iRG9tSM 085x+cKDWuluKnAn9dTxc4ce/Lrgoh3KWeXF1KiehPnnBDoFTaicygCFY7/X+pEgsdIJ X4JB/scNXSaoI8NpWoOVULtTTEGRhTWZHSceaKceeuKUPwWxWAMt2m1ga7oqL2T8++kG aETrZ0GjK0u9SeVPZNonfBOrdighEiJtMc0EFv5h9Bkn2DH78b+DptrAbTysh5PyPlLd Higw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=XhEKfxYlxgk3agoDhPRaI4ZNYc3sN1RC3NsA3KaFSFI=; fh=M1YRlkczXeRhSvSXIx8NV0Om9XcgYKWRjfb7nZ2k/Lg=; b=AqQ4aCihzIJEpaSh6sNe9GSlN3q0c6CzRL1UT4/91ybYhYfUtmhIixln4/vgCIQwoX ZYymCXfwvm5QJLhhxckeEsqdJhSnYY6L8JDGyPU0TPogTI5qcH06zJtjNSMucva0b0sf xrU3Xl+ns4fbCTF1vUEjvdKHuzya9Piq8fN434bho2OlOc/sxebi1JA9Zb/LorW7+nyY G1tVVWkkRugd+of0F/DWa4LkCfanWqNgvA0lJArkB3+ISLRns010fGc6sHxXFgnhs7MF hyixB5JBgcGz+kNX1hAOaQ1ex4su3CR+0yLmqIL8g4Vmkmt+n2drTlucTYNZSW5/MSDL LyiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=NnbBuKeK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id a6-20020a654186000000b0057745b2d018si97635pgq.390.2023.10.16.13.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:36:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=NnbBuKeK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 95D68802925F; Mon, 16 Oct 2023 13:36:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234290AbjJPUgL (ORCPT + 18 others); Mon, 16 Oct 2023 16:36:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234232AbjJPUgE (ORCPT ); Mon, 16 Oct 2023 16:36:04 -0400 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05108A2; Mon, 16 Oct 2023 13:35:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1697488550; bh=U1WgWCtmO/bEZ1AED24mCSnyrNXJpL+Y8jZtS7Uiqmw=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=NnbBuKeKpbCRZiKTZ0ErYxqllKdbeGYbOkrq7PCgezUnRSCKITL04C3B52B4ezIC2 qbWjx5knHEvFjx/c5qAQDFXWn4Gq1xy00JsQOD5qStbtjJ0JXZQP9eFmH4w+6qbKrk i++jePBXe+2YsLtyp8j/DCzzc/CrE87I4JuWKRcHLIaXzAL4BCGCTL7OLrEmTcZTlf /a4FJ6fSFhuU3Ow4xYUbIFIPmBMbTyDa/pzGfpK+kgNvBjOvcVPaYhy0A4hOmfl538 kFfoa8qrYOXCvCsZmeSve3t+x5tf85mAbx5H0jX9qIkYpcnSvoeHTkh4jbUMMJpHQR 4u9r4mx4oGR5g== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 298CE10414; Mon, 16 Oct 2023 22:35:50 +0200 (CEST) Date: Mon, 16 Oct 2023 22:35:50 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Karsten Graul , Wenjia Zhang , Jan Karcher , "D. Wythe" , Tony Lu , Wen Gu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/11] net/smc: smc_splice_read: always request MSG_DONTWAIT Message-ID: <45da5ab094bcc7d3331385e8813074922c2a13c6.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20231006 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MISSING_HEADERS, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) 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 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 13:36:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945793182861719 X-GMAIL-MSGID: 1779945793182861719 Otherwise we risk sleeping with the pipe locked for indeterminate lengths of time. Link: https://lore.kernel.org/linux-fsdevel/qk6hjuam54khlaikf2ssom6custxf5is2ekkaequf4hvode3ls@zgf7j5j4ubvw/t/#u Signed-off-by: Ahelenia Ziemiańska --- net/smc/af_smc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index bacdd971615e..89473305f629 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -3243,12 +3243,8 @@ static ssize_t smc_splice_read(struct socket *sock, loff_t *ppos, rc = -ESPIPE; goto out; } - if (flags & SPLICE_F_NONBLOCK) - flags = MSG_DONTWAIT; - else - flags = 0; SMC_STAT_INC(smc, splice_cnt); - rc = smc_rx_recvmsg(smc, NULL, pipe, len, flags); + rc = smc_rx_recvmsg(smc, NULL, pipe, len, MSG_DONTWAIT); } out: release_sock(sk); From patchwork Mon Oct 16 20:35:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 153751 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3711723vqb; Mon, 16 Oct 2023 13:36:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHMATXQWGe2R0ER5js0YrS1t3o8V2VG2qW93Rmz3t0uJKPndAhUqv86wjjCybAe/FFVvQuc X-Received: by 2002:a05:6a00:3190:b0:68a:6cbe:35a7 with SMTP id bj16-20020a056a00319000b0068a6cbe35a7mr253610pfb.2.1697488593602; Mon, 16 Oct 2023 13:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697488593; cv=none; d=google.com; s=arc-20160816; b=fwTjj0a0tUOFrEEyk2ay1YxgSYVBV+ZpxK3zk0avNlKVgDCQtY9S0qQvJveNjOIRK1 IR5xg0a8heXO8sMY0MBbPl/QMXH9LR5UkHTlbyEMjlEwieSNbuXU62+eN132SlZ6qr0m 7QEzOizQBnomKh7tw774aZP55KKaHFa5fWtE1f2C75VZ+bB9xbMHz6PpalvkbBGjShaJ Yh9m3jJ73WxgB7MFZUbS6Wi2AXnu2cHcMe6d5mQXBDQsbI8N7OOVc6nHZsNH7BQezwm7 mV3fO2GEUxLagb5UDknlIZkgXdjl8rVa4S8MtGVEZIoIg1XyDjFcPYwfMtn7AE0w03+4 XkMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=tsMluF0Z0VBXaJsk17yfLaTyRhKMFfVCPd+72aI7zgM=; fh=d4z29RXO3jU5TBgADImj3VFDeAn0PRUJaPij0zYqvQc=; b=y8Fz5U46+Ch9tc53chbOyxpETqf2DEBFN0FuJBpJsIUCkBTLGHelWzrluurYNRL9UA s5pMzFr9WFgo+WIX0r6lrhQhoANVWQRIkzMNhukkthegqVH7RRecIkW6oADqudSyPw7a PK0yfh2flEVw/CzAtq4oAfn1bA6Ja9cgqyMQB2W17tCgzrLEH+JNZSY00AsyO+Um3uVu N/wJTubAMjkJaa8g006y+rAwgyfwIW3RI7zK/J704VbthRrKAvj163FB4GcHqlm4g/rD VvG2nbouvg9LfYCBI/fG4fLBIh2z3EsJ7+uEj3TVxskGkWAbgY2bQYT9dqmVxcgiUzsu 0Ouw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=lxMf2+MO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id bv4-20020a632e04000000b005898e10f9b9si122084pgb.213.2023.10.16.13.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:36:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=lxMf2+MO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 7F6788056C47; Mon, 16 Oct 2023 13:36:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234256AbjJPUgU (ORCPT + 18 others); Mon, 16 Oct 2023 16:36:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234226AbjJPUgH (ORCPT ); Mon, 16 Oct 2023 16:36:07 -0400 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 025A0123; Mon, 16 Oct 2023 13:35:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1697488552; bh=9mA+IthVHwQ9TSYNjqEKDb8kf+N/Q7iDq28AtGEeciE=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=lxMf2+MOA79RE4VScijXoK8rNPHRW9UOeU2uTN7EM3YPwY4rpMY26E74YOCzDsc0Z miHGoe4GCcbE5k25IyGVdqMmWJxWZh+jogsXmzP5wnwDpOlQoEz8ZWQTodNwrq06fW GVNIsHHOzTflFS5iB1HYVf1kIu0pyLi6X5qxFwTgwLlLMF75VYilOd/IjwCMyMNQth Uq8ISe3D6PQvpknfDVmM7vPOrsSu8KpwvEfBGTRC9PiOEeHwkdQCEvk5pHYFqklOWJ Vu9zdP6SkVzUBVkaq+S2OUUtjBaG+CoHmFWm4rErLjAhDe/Dek3x0yFFEhZDSmsdHB UjarR9JexTauQ== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 44257FD48; Mon, 16 Oct 2023 22:35:52 +0200 (CEST) Date: Mon, 16 Oct 2023 22:35:52 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Howells , Shigeru Yoshida , Kuniyuki Iwashima , Cong Wang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/11] kcm: kcm_splice_read: always request MSG_DONTWAIT Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20231006 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email To: unlisted-recipients:; (no To-header on input) 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 (groat.vger.email [0.0.0.0]); Mon, 16 Oct 2023 13:36:29 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945799524740614 X-GMAIL-MSGID: 1779945799524740614 Otherwise we risk sleeping with the pipe locked for indeterminate lengths of time. Also: don't pass the SPLICE_F_*-style flags argument to skb_recv_datagram(), which expects MSG_*-style flags. This fixes SPLICE_F_NONBLOCK not having worked. Link: https://lore.kernel.org/linux-fsdevel/qk6hjuam54khlaikf2ssom6custxf5is2ekkaequf4hvode3ls@zgf7j5j4ubvw/t/#u Signed-off-by: Ahelenia Ziemiańska --- net/kcm/kcmsock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index dd1d8ffd5f59..de70156869e6 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c @@ -1028,7 +1028,7 @@ static ssize_t kcm_splice_read(struct socket *sock, loff_t *ppos, /* Only support splice for SOCKSEQPACKET */ - skb = skb_recv_datagram(sk, flags, &err); + skb = skb_recv_datagram(sk, MSG_DONTWAIT, &err); if (!skb) goto err_out; From patchwork Mon Oct 16 20:35:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 153750 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3711716vqb; Mon, 16 Oct 2023 13:36:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHq5+2uK2q2UkCEr3VohkGqb8jq+LfH831Y0rXQXajb0rP4DftRzXbwr8qVtMqrdkCQfNSG X-Received: by 2002:a05:6830:4598:b0:6bd:6d51:e9e5 with SMTP id az24-20020a056830459800b006bd6d51e9e5mr356624otb.0.1697488593015; Mon, 16 Oct 2023 13:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697488592; cv=none; d=google.com; s=arc-20160816; b=rlm7ebtMpvJRMlTETYQvsVRMqKZ607n+GdgSwD73NDekiAJir0A1TwwjvCjybnJICJ GWps1dtt5aZKUb6b/UegdDAEXRLhQKiQoALpgkygVYZWrpRHvlY+gpf6Yl71X2AB0vQR mrYv6fCnhFlgwIEcIHFJgc0Yqsr0xhQXPV7eacwjtojm+MhwaAo+zVUfbUktWhDRX2Jz IbW4s5zCyMBiEshaZdbbZ0LWRDcYFPJtrnpb5UMPa42wTMXZ11tZO+v9V5MYt+wr3sOC vlaHK7GhClxWQrfV5F91BwlrXiGd83iyNjBX9qmOlto/3ft6asvpOmiRsoGzASmmhSOr IOIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=SgVhm1POFGpo3yXYdwLtSO+R9fgppxSkqOFJ/Zl4G6g=; fh=aZmxRmvxoZlw0aVEwWHxGAsdH6sZcaq11OJRQV3SbRw=; b=bnSzKmwbzOlvLoX+o0t1ny4rA8xlThdyEdpSuuYlOESkjN1HYKtPtxDPEcOCCS4YaT xaJYBcrVwUc020rMicuAPkh6HJBokZ8nO8aiXKDh7WflgQTJQ8e7D7+16WFcbJURcp9M wOaKKEIQ8aO5ugKnrDhOMLBeFjQxeWZM0MR6OcsyuN2mGcAqBx0Gu8+i1A49LaH6Jh03 v26YJLMLsQI/19zi60JRImJ6uWQXQKoLh5zNjY3jx7pesOIZRQT4rIWggZcqySAJGvat dKGVPgDv/cxp3Pw75LYwOKLC2U021OfHoltof57WkV44dMlvS28jSSHHCgg9lW+pX49r HCdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=jRVa45p8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id c66-20020a633545000000b00577fc59373fsi110141pga.296.2023.10.16.13.36.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:36:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=jRVa45p8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 06E8C8029234; Mon, 16 Oct 2023 13:36:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234299AbjJPUgM (ORCPT + 18 others); Mon, 16 Oct 2023 16:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234248AbjJPUgG (ORCPT ); Mon, 16 Oct 2023 16:36:06 -0400 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 498FD12D; Mon, 16 Oct 2023 13:35:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1697488554; bh=yKqnk4KdW1G8ysN8p/704fCo5DUzCZ+wWpZiakGmbbc=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=jRVa45p81I96MvAlHdov6fY8gT4VGBQoFIRSUCCfB6WfpqB46snLFIrXqqaC7D6tx qx2WoDz18lqvDyrYgQPZ7oxDzQ2bbLlGebQ6bmYjgr19EHMJNHV3ldO9ZmbLTSwp+f v6Ap2pIY0JNAwg6ZvUFfel2aFzlckL8o+bJkB0nfxwmtwHWGxZajW2/jbAhncs0CPx bv/5EUD++wYozIZLaSDlMF1luRAfwWuBv3NwS73kWGYk9IsC4meal1ogWUNtAzayYu 6SFiFSRvno0UvsRHN7hQXxVgmV8gmznX4kmKJjG5Of33d198+kPS4HHIeyO+AL2rQW UcFqRDvfltF1w== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 7910D10418; Mon, 16 Oct 2023 22:35:54 +0200 (CEST) Date: Mon, 16 Oct 2023 22:35:54 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Boris Pismenny , John Fastabend , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/11] tls/sw: tls_sw_splice_read: always request non-blocking I/O Message-ID: <0fffb097b4d2b328ef16e7353d6829f1ec9efcae.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20231006 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MISSING_HEADERS, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) 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 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 13:36:27 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945798902264229 X-GMAIL-MSGID: 1779945798902264229 Otherwise we risk sleeping with the pipe locked for indeterminate lengths of time. Link: https://lore.kernel.org/linux-fsdevel/qk6hjuam54khlaikf2ssom6custxf5is2ekkaequf4hvode3ls@zgf7j5j4ubvw/t/#u Signed-off-by: Ahelenia Ziemiańska --- net/tls/tls_sw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index d1fc295b83b5..73d88c6739e8 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -2145,7 +2145,7 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos, int chunk; int err; - err = tls_rx_reader_lock(sk, ctx, flags & SPLICE_F_NONBLOCK); + err = tls_rx_reader_lock(sk, ctx, true); if (err < 0) return err; @@ -2154,8 +2154,7 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos, } else { struct tls_decrypt_arg darg; - err = tls_rx_rec_wait(sk, NULL, flags & SPLICE_F_NONBLOCK, - true); + err = tls_rx_rec_wait(sk, NULL, true, true); if (err <= 0) goto splice_read_end; From patchwork Mon Oct 16 20:35:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 153753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3711887vqb; Mon, 16 Oct 2023 13:37:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlR6Wf7sEezVxR+Elwe4CMV8aSk/qUx9suE8NFzpinMVvAbFKDq1+mxn8T+2jPF3KjZZ1o X-Received: by 2002:a05:6a20:8f2a:b0:163:d382:ba84 with SMTP id b42-20020a056a208f2a00b00163d382ba84mr156351pzk.5.1697488619893; Mon, 16 Oct 2023 13:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697488619; cv=none; d=google.com; s=arc-20160816; b=LY1CO7p4j3K1obzfAjYlWbet4w0LmN9o3s6RMbFHleSiG3xeo5iQ9Y+wh+Z4opXTWD BwGnjd7SWLbEl1G2evehL42VVC3qILe5GiSdS8i3af7n+xV+VlE3nJPJeQAnjWpWLu+j ViVkYngl1tvYXyb+Vi//tGrlViLbMhQDpXPsK6mfyUamNO8vA+bEveCZSSDMx5/nDsYp 9KuS38O5qZ0g+LL/cD05liDXiCY+l75M1EKbQk39H904r5+SmgAaboGt58qvjyPBPXJk 6WV4v4ldlDZwZ/M4gfWs080+kqC1xLKcM0HFChnoiHqEpYVW/2b8QhykAhZnU6dqHXRy yyMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=l1PtJSN/I8m3vayh5hsywgRFHMsj8/pw5wAcw0S5/Zw=; fh=KwZ3wEPimNjBeMiHhaOl2Rz8VAJi6umDd4UaHqS5lCo=; b=pbMiDnziiWYvd3W8n0jwQ6FTAQ3HhAaj5eP+lzAb/yajUmTN8RKkMJGPYFvBrE7BNc golCkcujd5opMeaF4S++jcrJQeG6tUdE5ezeJTv30uvxmesffjTprxZo78Uthk5n9bly TnuZXN4g6b9Y5EyNHDSP+xWMOiqC3m7WNcnffwDfoCSjbYytZl9ylsUfSUX4jg2OZBbC nLyzNmSaLQP4cyKITmF8U1WioCX+S7/ecz2QXNXBgFXwebz2KMJQW4oPJm/A4ccutfkt Z5yYA8QhmxBSx4ZFsP+q2pzuOASCjOl55JlqgxVBlgMe48HNsWosjrRzqHV6nlAzoWfG DYtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=UmpOEYPJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id x18-20020a17090300d200b001c60d334996si74054plc.622.2023.10.16.13.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:36:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=UmpOEYPJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 ACC3B8021EED; Mon, 16 Oct 2023 13:36:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232817AbjJPUgc (ORCPT + 18 others); Mon, 16 Oct 2023 16:36:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234235AbjJPUgK (ORCPT ); Mon, 16 Oct 2023 16:36:10 -0400 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A20A181; Mon, 16 Oct 2023 13:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1697488557; bh=9/Rch1NNnuQcxUUP1sdNlrNNgx7qX1hxKSFQK/3R+Pg=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=UmpOEYPJlFLiL4ag5qI+r8wZnOjdoxGBe9TfIsmDRZajgouiqNxZIFuEPmq0+t0dQ XjWhFPb64jAe3/1/E7WKRc3Ygdb9pGYU9if2p7IqdndK6KJ8GrBb53XK4WCsLpu78l GkAyuT4vdjDak/FatVvwXqPcKN4WjZDqSOHGvfLI7AR6N5xvSSbf53N0/Iji9xRtnR YZyvcwA2KvsCuVaMmxmXgyCAVFZg/LCrx6pFjfeVTSfwIr2c6FcaMOiFhJXsYe/5rk pfiDdyRNRKP+LR0YKcUBN668YPC9vsuIw7Sipc9Wiq9fw+t6hPM/0XI05F9OErBe36 1sb5wxpR2oNXg== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 043D71041C; Mon, 16 Oct 2023 22:35:57 +0200 (CEST) Date: Mon, 16 Oct 2023 22:35:56 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Eric Dumazet , "David S. Miller" , David Ahern , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/11] net/tcp: tcp_splice_read: always do non-blocking reads Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20231006 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email To: unlisted-recipients:; (no To-header on input) 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]); Mon, 16 Oct 2023 13:36:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945827179300182 X-GMAIL-MSGID: 1779945827179300182 Otherwise we risk sleeping with the pipe locked for indeterminate lengths of time. sock_rcvtimeo() returns 0 if the second argument is true, so the explicit re-try loop for empty read conditions can be removed entirely. Link: https://lore.kernel.org/linux-fsdevel/qk6hjuam54khlaikf2ssom6custxf5is2ekkaequf4hvode3ls@zgf7j5j4ubvw/t/#u Signed-off-by: Ahelenia Ziemiańska --- net/ipv4/tcp.c | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 3f66cdeef7de..09b562e2c1bf 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -782,7 +782,6 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, .len = len, .flags = flags, }; - long timeo; ssize_t spliced; int ret; @@ -797,7 +796,6 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, lock_sock(sk); - timeo = sock_rcvtimeo(sk, sock->file->f_flags & O_NONBLOCK); while (tss.len) { ret = __tcp_splice_read(sk, &tss); if (ret < 0) @@ -821,35 +819,13 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, ret = -ENOTCONN; break; } - if (!timeo) { - ret = -EAGAIN; - break; - } - /* if __tcp_splice_read() got nothing while we have - * an skb in receive queue, we do not want to loop. - * This might happen with URG data. - */ - if (!skb_queue_empty(&sk->sk_receive_queue)) - break; - sk_wait_data(sk, &timeo, NULL); - if (signal_pending(current)) { - ret = sock_intr_errno(timeo); - break; - } - continue; + ret = -EAGAIN; + break; } tss.len -= ret; spliced += ret; - if (!tss.len || !timeo) - break; - release_sock(sk); - lock_sock(sk); - - if (sk->sk_err || sk->sk_state == TCP_CLOSE || - (sk->sk_shutdown & RCV_SHUTDOWN) || - signal_pending(current)) - break; + break; } release_sock(sk); From patchwork Mon Oct 16 20:35:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 153752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3711788vqb; Mon, 16 Oct 2023 13:36:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKmwajAAjZKVmJiCHE9yIZExRIXlU/wciHcQCaX/D+EfuDVu4qhkFjlUoWxVeOBx+EpQgE X-Received: by 2002:a05:6808:198f:b0:3a9:efde:a022 with SMTP id bj15-20020a056808198f00b003a9efdea022mr449627oib.5.1697488605522; Mon, 16 Oct 2023 13:36:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697488605; cv=none; d=google.com; s=arc-20160816; b=YTbXMUUKKowXUwKDWV4mJ4OTsz4iw7iXebu+qYUJk19bO3Ocz2u0Gy5bpJm8uCD6Ow RLy4kr+Rg81UM59ksGU0U/yTY9OQWtTMYWx1C7e65j5bJr7YMbRdSw5KX2Pjb09uT1Po B7AgJ8cLGHJwBPktXAniMPSEixwffxISzLCCUggDXTL27PMaCUGn8OpwJyuc0+k9h2xE 3ErLYadFRyN5HRF2kRTlcqYBhka0h+6StVA3xMEZK5ZaMX3kBf8o+bdBQxw2GCzpD3dH /RSdZLlgvp6chj5PWZ34lluC6w+u9IKPFwCPD+wD3mexylU3BfPaDr9zRhFfcjjX4yJX s9Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=G8dHxgA/U91iwdBMSSqIaarBh1Cx6bJJWaUon7i5IZ8=; fh=Oskmylf92gQgoWcJVK2DZkdbYki3SlnV/gEzpmChMXQ=; b=mO93WSWeD8VIYb4f/GU8/6RdYD/3+824UDQV/jTZFjy0C56cZf01B566mhccf1JDY/ T4M/H5nNmiFbzpnoAFAYSqqCNQ8htGjCRVzhb8pe9WJP8cUwkFKuJzapCEceRModICJ4 RNS3s71hoQfT2HarTt2/Za5AEMW4JFOCFBG01g5Xn4/PsJEaCmBkBnANA+wUl5ntIELi eYg/JaaMKO4fTrvpzHmy51mnA7l0MpVWsP4Y2xhqj1xLvy0aEvddqn+sNsUkwBnpVGPI mFaLhkp8a1/oLB90l0FwTaIwtAIgiHfbinb4HWmdJE3glOTuZgAkEjheieVhg3uJuKK0 07Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=JVhaOxgf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id o6-20020a639206000000b0055c77028579si88005pgd.747.2023.10.16.13.36.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:36:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=JVhaOxgf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 364448029051; Mon, 16 Oct 2023 13:36:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234323AbjJPUgg (ORCPT + 18 others); Mon, 16 Oct 2023 16:36:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234286AbjJPUgL (ORCPT ); Mon, 16 Oct 2023 16:36:11 -0400 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03DC6F5; Mon, 16 Oct 2023 13:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1697488559; bh=AbhKjmGcFK7a0VSiC3Uyp/FqZCpYv3ilKDudDv/H+vg=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=JVhaOxgfx7Mls92DNPEIWl9LDiGpLsqnYzvsIikxwThGSQkKph//v1LaOuQww4Jxs 834qWDOxzlJZ+w3TVxkD/3tpeLhRRRkdC5t+fKPiLNbdpSakUTP/vVweidpMvXV/4j 0dgVhKfiNO0loNffmpqR1pBfze63D4UcGtKLRhaXHvIaleLWumdMi26LAipBDTplCd KoGZKJHXcsIS2oJ0sWeV3HjJFTTxZWaAUV7oKOnQzlIvejR/hrjok+SxPcRKCeZ5B9 6Q8ng29ppdCpc3MKP0JtRI6fKZVE+e7u4Q4ptnz/0LakLzVpNjA+kvLC1ImClyMSR4 RsIlD/R+AywNw== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 1CEFD10502; Mon, 16 Oct 2023 22:35:59 +0200 (CEST) Date: Mon, 16 Oct 2023 22:35:59 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/11] splice: file->pipe: -EINVAL for non-regular files w/o FMODE_NOWAIT Message-ID: <5974c79b84c0b3aad566ff7c33b082f90ac5f17e.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20231006 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MISSING_HEADERS, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) 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 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 13:36:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945812061719191 X-GMAIL-MSGID: 1779945812061719191 We request non-blocking I/O in the generic implementation, but some files ‒ ttys ‒ only check O_NONBLOCK. Refuse them here, lest we risk sleeping with the pipe locked for indeterminate lengths of time. This also masks inconsistent wake-ups (usually every second line) when splicing from ttys in icanon mode. Regular files don't /have/ a distinct O_NONBLOCK mode, because they always behave non-blockingly, and for them FMODE_NOWAIT is used in the purest sense of /* File is capable of returning -EAGAIN if I/O will block */ which is not set by the vast majority of filesystems, and it's not the semantic we want here. Link: https://lore.kernel.org/linux-fsdevel/qk6hjuam54khlaikf2ssom6custxf5is2ekkaequf4hvode3ls@zgf7j5j4ubvw/t/#u Signed-off-by: Ahelenia Ziemiańska --- fs/splice.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/splice.c b/fs/splice.c index 9d29664f23ee..81788bf7daa1 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -1300,6 +1300,8 @@ long do_splice(struct file *in, loff_t *off_in, struct file *out, } else if (opipe) { if (off_out) return -ESPIPE; + if (!((in->f_mode & FMODE_NOWAIT) || S_ISREG(in->f_inode->i_mode))) + return -EINVAL; if (off_in) { if (!(in->f_mode & FMODE_PREAD)) return -EINVAL; From patchwork Mon Oct 16 20:36:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 153754 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3711894vqb; Mon, 16 Oct 2023 13:37:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYb7p6QuK4ywvpSlPeuO41lgKUgAXkvvJ6czpWm4I079moedZYboE4Gbqurs6yaHWiVHwc X-Received: by 2002:a17:902:f092:b0:1bb:ac37:384b with SMTP id p18-20020a170902f09200b001bbac37384bmr362934pla.6.1697488620871; Mon, 16 Oct 2023 13:37:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697488620; cv=none; d=google.com; s=arc-20160816; b=hqBYcnFhN8jTn8/pOz3HsZr3Xnxp0IAnaDm46sIhZUAR6Hi7zq+KN3vE0p4HsSOyS4 zKlKaLzYF3bBFhS6a5nElJGz9gtdMu8FFR5GWYds7VPrMjED1iYOj+QwK5WXkTRIN+6C JeXzYyo48QbK+B9Ll2dxpfpFk32GocSnuMJq5HFRwaOvml7jk5xAdkMurhCaXlsI3+qp RrgpkJ0LaH9M2Kf9JQi0JbMRhimQvc83AKgM4hM+U3WPrYriMz3LDXDs4yZogVq+aXM8 yjXOlYW+Z5MVd94SqU7NE6HVlKCHGZfbJqlaXdif0+IWVJ9KkCiwjsAu7Rj6uNh6tCs9 nE0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:from:date :dkim-signature; bh=2BVd4gW1amvRoJvl5VvpLuR6Ry0NDgNbTlD5jg3Pjbs=; fh=Oskmylf92gQgoWcJVK2DZkdbYki3SlnV/gEzpmChMXQ=; b=mYvBH3nyp6RQX0Weo9voqUKAFafDWQZUsM6sCk1g2bWLOxZPcXeP8oQmE8KX+ynHBo a+Icd8ffVhZpUGmRjmhwJ0priBJEfeq7Nvjk+rCLaz+a5jochocnLA6ciWFsL/YOgM61 Bx9wMwUOtHDPJNibYHo9CpoHoo6qUUAvmvB0XAL1S+I/myMf2YaTPeqVDfWLhkPVnu9I YBvV7eNjnNXk+7FUEyTpKXNwMGZ9AycQzSKUHTJx8dz9xepOIj9YmexKyErCajo6nDOT aKOg+xne/BP2cI1VsHJs/XqpcYVbm6owuQ7UrNFFSDV3uLH0wLqK+UkwZdutw8qE8Bcz k9wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=C1tqd1IU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id t4-20020a170902e84400b001c77674ea97si97777plg.423.2023.10.16.13.36.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:37:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=C1tqd1IU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 24C4380BCBB5; Mon, 16 Oct 2023 13:36:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234255AbjJPUgi (ORCPT + 18 others); Mon, 16 Oct 2023 16:36:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234308AbjJPUgS (ORCPT ); Mon, 16 Oct 2023 16:36:18 -0400 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01D7119B; Mon, 16 Oct 2023 13:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1697488561; bh=GkcnvUcVpOCe5CAn1FqxU2g9Mal7SpC32VFF9WWd900=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=C1tqd1IUfTUwcsTencFYK4ZinxRZ0QuZ2dZaoE4ARNPRyq9gW9vWpdT8w5ibyI9IO r/FM5jS6XvZd94ewaBp3MmdkRCL01YlZZssVYT41RzBlOUuSwQmqV+o25Ai1oqf73g whBgvc+ZQIe1ix40Z7jL4XY9W38v3Z3RqOdHieeMFPqJmKEnGktgj7gqgPU8eFoxmn IucbGc2OFlHummOanDb/K4JlQDjB2Lrog6jG0eHqeDRjXWJq25q7gLNGnW7fC69FOK cZaaNZmMMW+ARrhcgZtdy2gtZEiAZ/iNRHUwVcZRPlnB2HWc4b5sja3KX4egmRmtL5 DhT5tHfmd/Wsg== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 6EDA4FAF2; Mon, 16 Oct 2023 22:36:01 +0200 (CEST) Date: Mon, 16 Oct 2023 22:36:01 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/11] splice: splice_to_socket: always request MSG_DONTWAIT Message-ID: <813e1805aa942862d300bec4d0563c5a466dce78.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20231006 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email To: unlisted-recipients:; (no To-header on input) 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 (pete.vger.email [0.0.0.0]); Mon, 16 Oct 2023 13:36:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945827906504267 X-GMAIL-MSGID: 1779945827906504267 Otherwise we risk sleeping with the pipe locked for indeterminate lengths of time. Signed-off-by: Ahelenia Ziemiańska --- fs/splice.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 81788bf7daa1..d5885032f9a8 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -869,13 +869,11 @@ ssize_t splice_to_socket(struct pipe_inode_info *pipe, struct file *out, if (!bc) break; - msg.msg_flags = MSG_SPLICE_PAGES; + msg.msg_flags = MSG_SPLICE_PAGES | MSG_DONTWAIT; if (flags & SPLICE_F_MORE) msg.msg_flags |= MSG_MORE; if (remain && pipe_occupancy(pipe->head, tail) > 0) msg.msg_flags |= MSG_MORE; - if (out->f_flags & O_NONBLOCK) - msg.msg_flags |= MSG_DONTWAIT; iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, bvec, bc, len - remain);