From patchwork Thu Dec 14 18:44:51 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: 178869 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8767176dys; Thu, 14 Dec 2023 10:45:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/df7nj1QAvhrh/QlZne59Hugm67rgbUawa0iyKCwn1qsuFDiUiSGoK94xzow996XPITgx X-Received: by 2002:a05:6a21:148d:b0:18f:e0f1:5546 with SMTP id od13-20020a056a21148d00b0018fe0f15546mr11588899pzb.47.1702579505204; Thu, 14 Dec 2023 10:45:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702579505; cv=none; d=google.com; s=arc-20160816; b=R0JQKJuP0KVLGReHEOt6HXxfsdMvp+LLbTPuvvM4t/u51rXrlrTvZNOVH7soohUjbg Wt5c1VSFRm+1mzcfgkzHSSk1Z9rqSfFJ62Y3eiIc+m8rCvRHUEkSAt5XpTUtKFAINg7O zwfbLpaSteL2pDnVO4VLlr4j99e9Eq6RJ4HWyulnQcpcJNKbkAW6wBea901LSOHmaiOg YEejsfrMtPOdZ2QnFW+M0Xo+O5+h7tPepNQtQ8youG9DOt/t9J2eSbKdcRKHVBDepjJX 2awLEK4IzJB/gnr2w1qiY0bsZKlmzvxpXhjpMLTsnLitEd0RCzuAdd6qAykYX2F8JKVJ orJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:cc:from:date :dkim-signature; bh=8ZpPb+5TBN0CJwomQ2qt50QrMAYOo6I2s3elnG/iSAg=; fh=F3CYGF5tLt2QRCGz6RnC5dSNkSKVVQOih9/vnGahG3Q=; b=JBav3yezmjShS1lGagVUGXG8e6e+/dqEq51x63uNwnWfs92znxYYRL2klJiDCMNlzG Rg2mevFYTdVPYT/vv5Vhw55v+Jxuaq/wdB5UrrqCctXY8E/8wjnIhjBY+9jlc2RuP/gN j472hLqkiWlCpktY8xwA6pw4FNZOzqqDh5QBUCUegTr+zU/bUQWPbj7shL591Ocv/v/S S/SHxjj2MATdZhd7KeJ1dXHMgN+sat/HIcPjzexo96/UOebqyschxTvs6WF4eio6mfrH WrbYwxDaqxBpuElg4EZqnqujij4jz06oM6uAjIhghQYLshQcH5ltWzGo0uK7vcYESJzL WR7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=cUjT6n4a; 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 c22-20020a63da16000000b005c1b2d6aa3esi11446867pgh.355.2023.12.14.10.45.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 10:45:05 -0800 (PST) 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=cUjT6n4a; 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 EBA13833AB16; Thu, 14 Dec 2023 10:45:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573124AbjLNSou (ORCPT + 99 others); Thu, 14 Dec 2023 13:44:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230159AbjLNSoq (ORCPT ); Thu, 14 Dec 2023 13:44:46 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6352410F; Thu, 14 Dec 2023 10:44:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702579491; bh=UlbAYUhQkYFyNtJ1M2+PZCXwVifWnRc57Lf02ijgdMY=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=cUjT6n4ajxvJ/v1VnWThnKiwjlEObK2pcYGAr5kVviu4KH1rfwsRBtF02fufgtpew qGDbCXySDE/un4pSFJktXoRyyaSSnnuYx4/DDW58CqK7m2PE9MU0oLKZ0WBNmj3hk1 WSrG+632f/2WesPzL02iAqnWO0j5v2rDflkZ/FqImhywQUdVOXR2f69Bhxy+61OQX2 FQ5wz6ZrkKMfWIqtUS41h7GlS5ty7k+A9KonF54Z/l7ezA1SzhD05VmZ7I8xJp38kw Pj0MRN+L72zNTq6YX0BC83tI2ndZS7YgloxbYaoVxEb4QB2mRTLHqKS2i0Bo8w/ugY ulggTsp4x6ExQ== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 93E7713078; Thu, 14 Dec 2023 19:44:51 +0100 (CET) Date: Thu, 14 Dec 2023 19:44:51 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Jens Axboe , Christian Brauner , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RERESEND 01/11] splice: copy_splice_read: do the I/O with IOCB_NOWAIT Message-ID: <29910c8026500ba43f3d93e66e822ae64980d9527.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: <2cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2cover.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 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]); Thu, 14 Dec 2023 10:45:02 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785284007288174385 X-GMAIL-MSGID: 1785284007288174385 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 Thu Dec 14 18:44:55 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: 178870 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8767568dys; Thu, 14 Dec 2023 10:45:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHi2mpiYDQchrsXpvzVboJhAdC//T7zAcFfD1SopEoiBTyQwpRCJ3kxW0G5Pmdm619jApPK X-Received: by 2002:a05:6e02:1c0b:b0:35d:5995:799a with SMTP id l11-20020a056e021c0b00b0035d5995799amr16420757ilh.52.1702579538854; Thu, 14 Dec 2023 10:45:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702579538; cv=none; d=google.com; s=arc-20160816; b=q9LyCivLF7H5w/fAhAI5Z8AKK38vcRUrR0OAbnCc4ydwrE3rj4j/cjGybiZy73Walj scT4wxpp6I4EFm8iwvtgMcn8ze8ZgSmN+wsPOzXsYzW+Lb6cnd3vTVNeDG1Imer1clir zJOLC1+7zHQl6Saq+TUSaU9supuZrDQLbokxqqR6OER9szkrLoJ/uZf/GcKWlZGrKmMG P078jgcGhDnU3mPXUAoGb2KOgwhhQayidW2aaO5MSV2fUDapwaaWs5SSkzgn8MFRDg9W 7Fn22k+pz7EQZ9N5nXmIAtNtAR/i2M4TNfW826pzYs40e6RpZglBn+0zv/uPJSnL8sPt 3j/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:cc:from:date :dkim-signature; bh=x8bEUWoPDkRpF2kz6JE197/SX2DupoE53xKypnn2fAE=; fh=Q4wcddOPlxwOEVKjzpwPQdn3QaX6ZS/SLpRqgg6nyPw=; b=duy4RA68xMMUB7dBFf3OVH1BUvDEH8wu6VpvN3M3k1LLTDblBrAOvi6qi3ghWNunO3 R87EnDChAUhoM2abYSXwophg9e5FKAX64mFbX4zBG+m7SyNIt7+U/8/VL9GjCF8lHYsp c80vzS26WjMakEMtaHIE4QLwcRhCmXn4U4EXGav+AJdPG0verZ60HWB9u53Koh9FAerp xFxgS96qo6LID8KyBM3qt1mIO3oP5VDoC1Tm5G4eqtrn184xIm62+idLygvRx4RlaIPX UDN7L3UfLp+TXSLBcujOVTGLJyUHUMdrcAe2Ay0vSWaZOZ4F8qipwp39zJ8F8Kb+gCfo M4Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=jHdrVrI5; 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id s15-20020a65644f000000b005c21d7d1126si11708209pgv.843.2023.12.14.10.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 10:45:38 -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=jHdrVrI5; 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 C1B7E80FCC97; Thu, 14 Dec 2023 10:45:15 -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 S1573132AbjLNSow (ORCPT + 99 others); Thu, 14 Dec 2023 13:44:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573139AbjLNSou (ORCPT ); Thu, 14 Dec 2023 13:44:50 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A816FB; Thu, 14 Dec 2023 10:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702579495; bh=HdTsxawUqvYBqho9F8qfYgYlmOiA88qfknRMSXgij6E=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=jHdrVrI5NZyeYt+K+FSO9zKM0tTA499Q1cB+K1dvZbIIKwM7zi+hpj7wvgNZmr04/ Sk2dELl2jUoSWvLp7A//4WuKVr9z4rEy6PqFY+LNOv2V8M5X85ffyZVWN220/NIS0b sA8JDl5dpah4bnW1EfP+RGorBMlQS7cqtym4B0dJf0P3xjtQIlVQLYwOFz+kA2jCaO YTKGUs70Ox8ei/67BnYdwOvclbIkAw4uDSy+RI29C7qaj/1jsUepUUC9PjUCrYqque /mQgTIETwDiVnv6YFez8wCuWMviss9E/QVpmxhF1DraMXfnLgMoVhj1quE7+9OMfAo itv8Acm2JtGWg== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id DAF0B13272; Thu, 14 Dec 2023 19:44:55 +0100 (CET) Date: Thu, 14 Dec 2023 19:44:55 +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 , Kirill Tkhai , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RERESEND 02/11] af_unix: unix_stream_splice_read: always request MSG_DONTWAIT Message-ID: <28db45d00902da22ae25aa16a0c28bb41002fc039.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: <2cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2cover.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 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]); Thu, 14 Dec 2023 10:45:16 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785284042300258738 X-GMAIL-MSGID: 1785284042300258738 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 Thu Dec 14 18:44: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: 178876 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8768277dys; Thu, 14 Dec 2023 10:46:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFU75sbb7PcqSzRaAnk0Zb1ZwwXr9a7mu7OVKofCDcD4cL663iEc3evhLHUhNUUEMMa+ZON X-Received: by 2002:a17:902:e80c:b0:1d0:a791:7598 with SMTP id u12-20020a170902e80c00b001d0a7917598mr11451435plg.129.1702579605412; Thu, 14 Dec 2023 10:46:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702579605; cv=none; d=google.com; s=arc-20160816; b=rQkAyHHmQMwzhUrXluWzuUkb96rqujGaWl0m4IIkGDl4+A54WbkqIV2VAGzYuro7sx nzZoaVLi6RxV6+yS/9UWQ87aQPYjjSxeR34EWzMW9iTNfMyqDfoe7AV1QjlKEuLuDYN0 qQvfG/cGtg7zGcCPUdtmvICUIG8Dc5F4EGTxBfH62Dkmv5GLyR090pMhb9xIqAsVu/Nq 1BViWFcSPLOPdMspRLdKPkOdufNAFWg70IE5T6IrCiUy08rjTi/u7uL2dfINe2NAwf3P ZvmVvH1ILCUzjYDF72edKkXPFLD2dE/NGY4pGlj8uweHtBe8BaHliR11FZTS+iue0yRE D9xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:cc:from:date :dkim-signature; bh=Pw8KuGCJLIC1bCiDHRlm89O3tIonmI8iK6z1vCXpiOk=; fh=K2Fdpt+HjY8vX9948rIe3SXncCNu97hhpRc/Melz/5o=; b=ddtJ50dsXychjPvu46aH+VyfiJGmQlhqF1D7qdFK96W6qSGjZRC8NusEUu11ukRUlF UAzuZPkXVORm7GT+WertQonHgthm8TIbHNfrb/QpNWkk9oLtv6Yr6tIWWQysM6OvXU3L NaMdRbf+d17lzg76bwg+8J4seZtiAo/6tVARF8TyRmDTaplbEwMqgM8KSu1ouZ2qJpfm 5uAvnGgdCHz12SGCEZON5JuI0cgK5eRK+vqEKgPX3uUs+Y8aoCSOEOy24fvvVqUZYelL rC+TALyEvWT5gVNzd33bl3Ar98LIUpeEuyte8uqjm5n8hJx4nRm0fv0yZk+cKBD+lpT2 +3/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=P8ju0Sm3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id e3-20020a17090301c300b001d341a2c05bsi4425340plh.583.2023.12.14.10.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 10:46:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=P8ju0Sm3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 7A8A3805E123; Thu, 14 Dec 2023 10:45:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573229AbjLNSo6 (ORCPT + 99 others); Thu, 14 Dec 2023 13:44:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573174AbjLNSoy (ORCPT ); Thu, 14 Dec 2023 13:44:54 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7665211B; Thu, 14 Dec 2023 10:45:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702579499; bh=4qtvhPDlYFbeuPt4vePPlt5K1o3kkOZ+MBZGGwh+FFM=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=P8ju0Sm3OMvOZtPNljKQPhXSyQMlfHEJtE98CO/ic0Ajw5eV+TDkGU0YSWCngB/rj aeenL8AE0EG/+c6NzgDJDM7uPl97/ipRZkB7IvpMSpOmcnwwGnrNrJcQEGp0heUAXz o5ivTEijg31QE7i9ynBuWG4JMqL/FLed/yHTx5oK6WwATt+jX1RqgmkYVrTZdPk5DW 2eHWCzVFfqO1a9ixMZlRCg8Hk/GegPSxe6S81hvwtpxW4Np6ZdLYQclS2jwoM+rk0Y 0diEBSA2uBsuSrKDe2CovEV9xHqdutsxMVtvPPPcnQ+C0nkfzgONxkxWz69Dmt8CIr O/u7/8m+IR5Nw== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 2811613792; Thu, 14 Dec 2023 19:44:59 +0100 (CET) Date: Thu, 14 Dec 2023 19:44:59 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Jens Axboe , Christian Brauner , Alexander Viro , linux-fsdevel@vger.kernel.org, Miklos Szeredi , linux-kernel@vger.kernel.org Subject: [PATCH RERESEND 03/11] fuse: fuse_dev_splice_read: use nonblocking I/O Message-ID: <2b5c5b0a18a59ec31f098959e26530ff607a67379.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: <2cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2cover.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 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]); Thu, 14 Dec 2023 10:45:13 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785284112254518333 X-GMAIL-MSGID: 1785284112254518333 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 Thu Dec 14 18:45:02 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: 178878 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8768970dys; Thu, 14 Dec 2023 10:47:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/3Z7W1et9/CNHa8E4jVZdjP6DgEbGPI4KnvsI7upL2pFpXEmc0JUxr6eWCi4yDk+m7V+2 X-Received: by 2002:a17:903:1245:b0:1d0:9e84:6a93 with SMTP id u5-20020a170903124500b001d09e846a93mr6332127plh.81.1702579673190; Thu, 14 Dec 2023 10:47:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702579673; cv=none; d=google.com; s=arc-20160816; b=VJ6hamAMjmv610iUtQmXQfhzkAKfuRJVVFl7HD59OeOB7or6U4DZWJ4q6wAaEgOz8V VJckYUFPzq4vcc81TIgBldKplP5F/UeNJ60cxWY3WNUWYmuaG3ghog/zF9FMYeiQMvkw PTnJXUHYN6tOnPROSi16Yqu9yEVrOhdb+NZelJQsbKaxd1JKjkso7cZBxyB3sMaS29ob S2hR/24mEjQqhKein9pt5rcR5nvjoo4ED7kTc6MjiwlPYD2gef13z4/wcoIgyNCwJKCZ n/yqMEGRv1+lV4/T07+DRooLzGT+YnjhN2QJnS4EJ6lHaZb3vszshzI1PtAGkKsnd1kM P/yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:cc:from:date :dkim-signature; bh=FR9jV8jtjjMbaLdWDfdcNqy5/rmLgKsRGvcsO5TSkbc=; fh=XDFFka9cucso3iet729PgLkonFHnaQhQVE3vmOioU6Y=; b=O2GdaTHB9cYnuDY8eto+YwUEWgyORDKI9vOAmBCvhjccL9jV7Wz3z3nob45mxPVPo1 4bNnGa4TdcAZnaH+ATA+LwbpPVmlozd0yGCY5EG7Oqp9M9JB9xetZI48Oa/ea1qjWbFh W/LOBH4CVGgVl3kMtpBCpdQR0WWQTNUe2EHzrE54LqRWeeGrB6nlvZjPwHLrnY4Jnc87 MYQQTbFTtIhHAk5i3kglG8oLbNu6T5rHVW3NeqhQXCSTH4IwVDCI6zW2k8vI7g6COGV4 0r/NB+qeT1HwFoY3bRDx2g318r45RCa3CNf+ZiS/g1SmYaWvNGSdoir6kkAkhvhlWhav zZNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=BTeEgmOL; 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 a20-20020a170902b59400b001d098bf0df8si11448284pls.612.2023.12.14.10.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 10:47:53 -0800 (PST) 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=BTeEgmOL; 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 5F23F836D61A; Thu, 14 Dec 2023 10:45:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573318AbjLNSpE (ORCPT + 99 others); Thu, 14 Dec 2023 13:45:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573215AbjLNSo6 (ORCPT ); Thu, 14 Dec 2023 13:44:58 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FB24181; Thu, 14 Dec 2023 10:45:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702579502; bh=SQnZ6NeLN5oEGpHe+yCkGHc7k0RaveLdBbAl+Im5Zug=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=BTeEgmOLsL91Kw433qClTnDJFQz8R8M6u4NFFrKujJIk1CUqMqVi5/IjHOi7L7cN5 qIaQmBZtSgm54+iBkAC8FLSNuCrgRIxP/tISAapoptKj56OSsDWvAoP04NfcAk6qih ZWWNzOD6zF8wVMIoYq7pwrFQNvQiBNfLYaOaH4Z4ugpnU4GHp1GkiapRIckJ+he1vZ GN494qBV24nnxOWzJtnK/gAAF08dvGrfYOUrOn49j506w90SgcJv7h6kGgKMWsHOkh DbnrSk/YuQxaptyc2iZJ6x8efy8aDFTLr/rtJLIyHYFMra6Vd5/t8c9MvFLUdbwqDd 9ORzWWuoBw81w== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 3A9B813274; Thu, 14 Dec 2023 19:45:02 +0100 (CET) Date: Thu, 14 Dec 2023 19:45:02 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Jens Axboe , Christian Brauner , Alexander Viro , linux-fsdevel@vger.kernel.org, Steven Rostedt , Masami Hiramatsu , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH RERESEND 04/11] tracing: tracing_buffers_splice_read: behave as-if non-blocking I/O Message-ID: <21b84f2e4e5eaad501ff7b2bb03e2ad2f25ecdf14.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: <2cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2cover.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 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]); Thu, 14 Dec 2023 10:45:39 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785284183344083096 X-GMAIL-MSGID: 1785284183344083096 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 Thu Dec 14 18:45:04 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: 178875 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8768096dys; Thu, 14 Dec 2023 10:46:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMllr2mvkYhZAs5qFtJCbfoqQq3vwdUJJQe88Gm+Sk6XBpLUTLp2MHKB4jKrmzdKUkpAZY X-Received: by 2002:a05:6e02:1645:b0:35d:5995:9047 with SMTP id v5-20020a056e02164500b0035d59959047mr9363157ilu.58.1702579591416; Thu, 14 Dec 2023 10:46:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702579591; cv=none; d=google.com; s=arc-20160816; b=m5uFD/ucfzMol8DwuLPu9p/B+ii84SEY6B0i1Vg7ayDz5krsVIBXIwwes2n0O+eq5G D6sn1MbJvVwA9oBwAKzDM0t2/S7HJwUno9duw4kyGKIQ4FPbZByQ8QpMaQHdq0FmzzaR JdZkicNkwc3IlH6yBD9Rvp9LLTELADhXbqDlm0vQ5UmD6Z1F5RA870sNOwn8QZfYPl3O /+mBLH1KE3Q6zNJENT1RYqULiZ1VjW4fJPugjuCYQmncymdi5UGx9Uz18sU4JHA47Lt+ 7AIxAWVITjEu+6vATaTbpoKgmNaSvmZHW+fhqUwDgNN9jeh4b0GowQXNjGcjkvCPJjD9 mvxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:cc:from:date :dkim-signature; bh=xXi0fqckUJZw3tezszpmiHvDPsWSjXS3YM58O0X+Q0Y=; fh=XDyHGiV6UcMMQgvXzqbF+yD5NmVlSQZ/RYvJDz+0sIQ=; b=bc3xZEy+XfTmqs1WtQbErOlVTzZByq+chrpxtcUpD/Q09uxtTdxHBrc+bkXYV5e/he D2wxoR9vO1KmAqZUESXtOXVGoOt2Y54VlkWh0Mbd0ffuX50opilsAFwTrNhTpEWsIAu4 bWmqk3dInR0zGQ5XMX7hDYkgHJRcnO15Y5DF/0GZl07u+cojdZXZCK4jGBDfWuZnZk6D WUAzR9mzsCvPWfpIb9VEJSujVJNpS4LglHacZT9o8OMfy7wcYnHquF3qeSdNZOd3hDou 7pw2l2a0z1ptWhiNXIv/aX/RGXJ44Cf0wdOjc6jgotXIDF7EXLjeLf2YGob4NSttHV8b 3weQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=QQwQ7kVs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id a13-20020a65418d000000b005c6998804a5si11750926pgq.160.2023.12.14.10.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 10:46:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=QQwQ7kVs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 E183D80752AC; Thu, 14 Dec 2023 10:45:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573200AbjLNSpQ (ORCPT + 99 others); Thu, 14 Dec 2023 13:45:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573282AbjLNSpA (ORCPT ); Thu, 14 Dec 2023 13:45:00 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4729518F; Thu, 14 Dec 2023 10:45:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702579504; bh=2ssiVml4m8qqmo285KKEoUuoX6hT0FelEWEeDIquwac=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=QQwQ7kVsirDbfrc3qHB34GkO3GIFQTUF/vVWaXTL/s5rXafsrY3xyV9wYGYQw6HE/ ee4penYF7q4qAgMlMeUkYnDYfVtqNkPvfxpgAm7dd0HewSWdnH4LUcKglTmgoSaS0f XIDSyCBKMi6S1fAjqdPtNgoDO6WjfMG/dlRUn1N+QD0EOGZiLN+MWnpBwJYpVOA4CT DbRwvoAKPmKFmvxFpm+p/bHNtncRBSTw+2S+L5aaCDpYOHvtOu09tJOwycBNkRyspd 78rfnsknZQ+OLAhKmOl9E673CaExiP8CZCuqy994nyfaU/kBnZqUpkS+fSEahYSKn7 YJsxSs1dxmbKw== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id D6DF413794; Thu, 14 Dec 2023 19:45:04 +0100 (CET) Date: Thu, 14 Dec 2023 19:45:04 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Jens Axboe , Christian Brauner , Alexander Viro , linux-fsdevel@vger.kernel.org, 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 RERESEND 05/11] relayfs: relay_file_splice_read: always return -EAGAIN for no data Message-ID: <2329ea2aecb56e982f16aea7c637fd0e8a7985506.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: <2cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2cover.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 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]); Thu, 14 Dec 2023 10:45:50 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785284097895595127 X-GMAIL-MSGID: 1785284097895595127 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 Thu Dec 14 18:45:07 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: 178872 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8767643dys; Thu, 14 Dec 2023 10:45:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHm4RxGTFymGGT+0Xs4KiPW+UxpkIak13+Zqo65ZcuHz+5+mYc/znGwwS2jG6PKrM2KfoMI X-Received: by 2002:a05:6a20:3504:b0:191:60c0:7cfd with SMTP id d4-20020a056a20350400b0019160c07cfdmr3007450pze.29.1702579547095; Thu, 14 Dec 2023 10:45:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702579547; cv=none; d=google.com; s=arc-20160816; b=ytxIrHRVIPXC6thXmNmTay9etk0J06jo/2TgGf7nvkMUgZB/VtPWuG0OENZ8R8Grtj ZQeK6fwK005KL1hoe59GBd/WQ7CZtoaHqkzCmHiHk5alZmtQjttidbrpA2Gni89AVflW sm5UIuDMB8rFSeK49X0S+L2NR1HVCyiaw1OzoC/D4yUpyHg/WSGrIpqLpflySG2963Rr EDhBpFm2lKw1nzaq3YTXcGlBWk7QKQBKCQrEcKREh+YPhhzepFJyMfkiLiqeNLSCwF74 R9RBOLAld4ZyUllQj8960MK40ntV+KoF4VtpmHyrY32kXWJoS1119EkRUfT7/EEFeWf/ q/Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:cc:from:date :dkim-signature; bh=Q4MDYoGPoX6W41QZ0ankN1lYY121k3qpQVEXamciMA0=; fh=ioFCLL6swPqZFJcIw2298d+T0gsqamKLYLZ3oB5Xyp0=; b=JadcntddGrP4J+aK1Dc7O7DwNJZVLxx863mo+RWZUZZRkKArhD/0V5rkurfYSMQp8N FEaKDwlGs1UKa3SEmMcMSNkxZAuAknhd2LfgkiGGeKXRBwRd/oByJGJpxUf+EkbF31mV Vt/G2hGioAUkoqMV31LYCzLN4EKytPUf9HebQsnAiX9EjwJncfN2jgw+pUHWqX6G+8+T DkgyqxsdS9agHU26FB2HJ9INS1B4betNpDle6agC6gv3o6klVORvnWIb0/N2MsuEEZGE WmQPoK3hFBA1ITPfU/RIPH+SPE03mcDAHNWUMnSOUsTUkOHEpAEbpDJQEUZBecnI6+y+ iPQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=oyywvtgX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id l9-20020a6542c9000000b005c21fbab567si11574009pgp.659.2023.12.14.10.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 10:45:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=oyywvtgX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 4051D8369F7D; Thu, 14 Dec 2023 10:45:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573347AbjLNSpS (ORCPT + 99 others); Thu, 14 Dec 2023 13:45:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235757AbjLNSpJ (ORCPT ); Thu, 14 Dec 2023 13:45:09 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A0DF191; Thu, 14 Dec 2023 10:45:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702579507; bh=PXy1R2vwiW8A+KWASBw8dr5/DmcBJ0IEf3dFC85mQcY=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=oyywvtgX6oB4Loxdmd/EoU++8RV/IElw8VF3Jy+1ZdFZhJ6d573To1kXtbm6XaZrf 6+GeDpcK8oRxScDdXUiFqwABUMekRu4SnvSlM4J9scZMnPHJeDSf+S6UmrU0HKMzww +d2AD00EGLyCdS4STW5c0WrmXDNzL7mHOCc0eKrJaPBa3ZNvDfsKWDdnmjh7zZXetJ +Kz6W/D0UGJvTBfTggfxoe81Rl8kyANYCb5d6vfWDRrPbj1K/hVt9TV6SVphxL2HrS 60byyjT0YCbKti0kKIM+PYPHZEd6z3dlwZphS8HxraVIv+y3ADdJ1DK2IjpKHUXs8G bZ24ZQirTcmEg== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 902331398C; Thu, 14 Dec 2023 19:45:07 +0100 (CET) Date: Thu, 14 Dec 2023 19:45:07 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Jens Axboe , Christian Brauner , Alexander Viro , linux-fsdevel@vger.kernel.org, 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 RERESEND 06/11] net/smc: smc_splice_read: always request MSG_DONTWAIT Message-ID: <245da5ab094bcc7d3331385e8813074922c2a13c6.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: <2cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2cover.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 howler.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 (howler.vger.email [0.0.0.0]); Thu, 14 Dec 2023 10:45:39 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785284050725791534 X-GMAIL-MSGID: 1785284050725791534 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 Thu Dec 14 18:45:09 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: 178877 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8768764dys; Thu, 14 Dec 2023 10:47:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEDYWOEaWnZrZVXjx+YghuiqP5ZUoZiQP1lJ1kIGfxMr7xfSHYRMsW760NCyt/F6spZWtR X-Received: by 2002:a05:6e02:1746:b0:35d:9c76:b459 with SMTP id y6-20020a056e02174600b0035d9c76b459mr15371218ill.49.1702579652272; Thu, 14 Dec 2023 10:47:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702579652; cv=none; d=google.com; s=arc-20160816; b=Rqbe7xUs0AdfBUCK6qaBcfa7RCXw4aBr9950gLvYc+fR5nNB/BOCgzbMnarh9i3uQa FgwPvSpNqbdWoYQl0CDT6arKvMwi8kr8uyDK38Mu7IMy3AtJIkDZIqYDRbQTrtyHezCc sVVZajaWxbZAcboTZpTQryG9lB0gJnbwGiABDudMcXsAhoEoly75a4SMp5/VKg8AcDGf AnznTW2MOiO/9W7f5e2xXDe40UJotH5QRha1GTrlOy4IYBnMq4QL0xj9cztQQ+i59K2d bjf/uEycdkxk6xpYSrd0E+HRKPfhvzsdxptv1M/dVVGLssOhx9ePWsOFNi2L8wBJqcRL BC0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:cc:from:date :dkim-signature; bh=60SEHpBlCV8nUJ71oCSEat0ahXp0qowsGHTwfQ2kQL4=; fh=vfFnS2j/tZWGMKMD5oFcr+ruqIoHrt3Oeto31ugfTBk=; b=segfbR81sckGXeOodj/tDa9gpBQ2qxaQG72wNeVnzTF4SMzBe4m5zvzgvhmC1VtkHQ Hs02SG1jUycYE0sV4YJf6pCDbSkpTDKggtQCeIMGtgjEYqJlR/79er2HG7GnOFu9lJgk AmJynC7+Hfg1cne6m2tLy2HEAemCSNV0HtRYOZLdGMwNOdhVil71VORqphQNwtXbXUZT UeeKsWi+hqtWHW5SElA6aCCVy7EA8A28m66vpQjY/ugwk78DXz3zf2xJR+cMfpmNyUQ6 LIPVVxnJh4Z0sxW9ZpjZjOA2jQ9s0W/5Nl3Of+oQS7pXoggnA7Ef/4vfZl/d72UFbGv+ E2QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=FbIkGS4v; 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 o34-20020a635d62000000b005c688ff3462si11808989pgm.585.2023.12.14.10.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 10:47:32 -0800 (PST) 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=FbIkGS4v; 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 A93208297C7E; Thu, 14 Dec 2023 10:45:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573459AbjLNSpZ (ORCPT + 99 others); Thu, 14 Dec 2023 13:45:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235780AbjLNSpM (ORCPT ); Thu, 14 Dec 2023 13:45:12 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C8CB1BE; Thu, 14 Dec 2023 10:45:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702579510; bh=3+ew1mEY+zwZ0CgM50WSpaK0xitBcIbGALQyFKzLJsQ=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=FbIkGS4v0GUxOMwpZJlneptUHxBKSzYD20ioLXKT+HVtqpA11z5FLvS89fMve8Aqv 5xkcim+9Tp+FuZqGQF+CI1uoQunfcooKH0/egoYxEC/lpEZtIpb/amxrbGsg9O0lQJ oGEFWBoO4XMANVAisRqrU0DNdWSM8hFr+s7vD4wBR3FZdU8Geg4O96DieeuesbNtxC n0lR5Bor5RQhxzoDOKX1XjnT5qW/LIzZqfqlWWOL+0CY4wBDSyL891hHBA7dzTELif 2hEzt+A6Hzh7ezQ2o9bGKKK5mbK/XXl7mmTfLS1s034e8DS4Bbvwe/XrQpfV5tjxol ZfQWcSieBFsIA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id E966413796; Thu, 14 Dec 2023 19:45:09 +0100 (CET) Date: Thu, 14 Dec 2023 19:45:09 +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 , David Howells , Shigeru Yoshida , Kuniyuki Iwashima , Cong Wang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RERESEND 07/11] kcm: kcm_splice_read: always request MSG_DONTWAIT Message-ID: <2b5a634f5fe1a89d42a7a4f91316f888b02ca576f.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: <2cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2cover.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 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]); Thu, 14 Dec 2023 10:45:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785284161730739271 X-GMAIL-MSGID: 1785284161730739271 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 Thu Dec 14 18:45:12 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: 178871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8767625dys; Thu, 14 Dec 2023 10:45:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWKXVdfgKf2lXB51VVab7ZOlQ8hFxhEZsUI/zgBwWUcRFvuv/3mxrT9FElHs6CMcHKmg66 X-Received: by 2002:a17:902:d50e:b0:1d3:3b52:d9a1 with SMTP id b14-20020a170902d50e00b001d33b52d9a1mr3191049plg.55.1702579545596; Thu, 14 Dec 2023 10:45:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702579545; cv=none; d=google.com; s=arc-20160816; b=bL6J6ZclFj6k7I8Qo7DF3oKUf19BHOT/NgtyYFvAawyU41K3EwiEMYMXmWNGRAmxRn aJZiRgyZwkb5Y9GpBsmIqASlvTi/fzwP1skFEMdYCQcaNgsvTJlwMZhttMSpSVNdoJml cECFVtHd/H5xS4NbW8zN+0ciZSnEZG6p9Ml6/WEeMMD7NSg1wd45bBVu7LBC6eK2PcTQ DJbqoqsn871zxSeRQqG3dMInSY5C+J6WrWQ/ZWJKiewo6VZXZLx2KNUEvi9pSzsbKyq5 Sv5MJfQ+JhLswuDwA9UhoUwWYSjUQKn3kC7NVHsYdo+dHnBMKWD0SANfbyTB9+WIU8WI nlbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:cc:from:date :dkim-signature; bh=mLwneLI2aeyLsDJV2JC6rAzMvUe9ZIz5kNnM1D3ksTI=; fh=bNwnBjfjGpO1h1FrY+Uq+7YFuXKkFQ87MIqd6dDlHZc=; b=z4pA5M8tPV93UD7mQY2TCu/C5A1pPdK2HhdBIQNnUpU985cIpx636COUFhirXyj+JW 2OFnVj2EoFmtc3ob7UQk6XnqrKiylvYw36Bn6388fmJWPyAU4gQzLTwj6HF0H9KUZPE4 eJIkXaqwsxq+N3C0pVe79AfTHPYCxJoAuuoFI/pMtdkBNEmF3oE9y9TGAz/Ueg5CO4aL v03vGQffRjTEu5wG+o+RY7s7haGrYFCO91TIWZlv15s+Bf9Xq+t3x9hykk+ucRfF5d4H HmjUSj3G+pWviKZ8Uj2F7Hwfj2XQhOX899JNdSXyGh7g68uFw4I2ZzCj6imW9esg3XLM SUdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b="N/WMy1GY"; 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 b6-20020a170902bd4600b001b7d2b55d8asi11367357plx.626.2023.12.14.10.45.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 10:45:45 -0800 (PST) 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="N/WMy1GY"; 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 824EC8068C78; Thu, 14 Dec 2023 10:45:41 -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 S1573509AbjLNSp1 (ORCPT + 99 others); Thu, 14 Dec 2023 13:45:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235787AbjLNSpO (ORCPT ); Thu, 14 Dec 2023 13:45:14 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0808D4E; Thu, 14 Dec 2023 10:45:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702579512; bh=8SccJBZdD6aVuGUXwvyxv46MttfctOjmM7x9ll4fJrw=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=N/WMy1GYhBqMQtyaK8cwvSxySt3AQyoSakF9rLNn/iXCBzqLaY6Gx6+A8KcCQvv5J snP/AEZA+0N/NiLDcCyBcOAtEWNmIuUx6aMCFbfOSpMEFLHmYjcA1Ya+QP0EL5ZymD vRBoWppY3Xhbn96WzNi4PoKiRsKtXuGBxyJ/GawKf1ktklPLVA8+btLH92qCV2NMDX gGY4KaHQvSXsl0zVsFwYJa5MAfbaz4VNtDPouHcTdYCzXbYqXA9l+ZXF47QKv7iX47 4cx7gwZP2ko1pSazp5XgCA1XK84jiA8M1WWWjOi4LCT4AYQWFzz6wItyYGuk2ZWqvS zOnez67wb8xLA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 4A9031398E; Thu, 14 Dec 2023 19:45:12 +0100 (CET) Date: Thu, 14 Dec 2023 19:45:12 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Jens Axboe , Christian Brauner , Alexander Viro , linux-fsdevel@vger.kernel.org, Boris Pismenny , John Fastabend , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RERESEND 08/11] tls/sw: tls_sw_splice_read: always request non-blocking I/O Message-ID: <20fffb097b4d2b328ef16e7353d6829f1ec9efcae.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: <2cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2cover.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 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]); Thu, 14 Dec 2023 10:45:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785284049587268648 X-GMAIL-MSGID: 1785284049587268648 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 Thu Dec 14 18:45:14 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: 178874 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8767911dys; Thu, 14 Dec 2023 10:46:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGg0nI3EmdCy2eNto6C7ovXiNqIkfXRxv01rYXTAw+A0WA+talHW/Dg0BPAIt7d+GDUYXYi X-Received: by 2002:a05:6a20:d405:b0:18f:97c:5ba8 with SMTP id il5-20020a056a20d40500b0018f097c5ba8mr4304393pzb.118.1702579573694; Thu, 14 Dec 2023 10:46:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702579573; cv=none; d=google.com; s=arc-20160816; b=bZc9u2ShR2GOEtQLiaLm7gOTXiLVwegqFtga++1Mr2PzMn1DsAgYzAml8VWXJwNeh+ ksUzQQAkXy2EIpO7rzwNJVpUCpo6cCxjy5p6r9BvSPFD4Z3xAkGlGLE6spbaWG5Og15E xd9pcPjxH3IzLkXaS0fibU43oZm1Urlkf62uJpcn0HUA0rV2fLIEuE1F2M6o5uhS/rAi q3RZbHmG1vFIuoANLGb7PuMmlA+u30/mmSl/p+hCFsLPKmo8YnpP6+jN7ghcDYf8Tzqw bxuhh96t27rlCFsNfQ/jO9GLD6LGEMi/HcJ43h3tDDTltOzXYmharNhYrRf4GlDV/P4N Zqpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:cc:from:date :dkim-signature; bh=V3qhLccmjzkV8OYaYeyVerOUqyion7gqzsSBK2gJwPA=; fh=Z13h9lVivnMQUbn4m0T31On3zZpbH697jSC5MQYwmvw=; b=0W37qnBRXtAv1RX+3eBW2WQf/opgd1Fo0hNmp3QOcTHqDycbq38gRb2gpqlyvT1AFo iJQQd8pc0G3I3FzJgILjSJRQnV+HJkT7N6RuBG/A5CvA//mXoiGyzWsxEQ0waGOUWtuD ra3gYG2rEBcUEb9E1tap65VOd4UUyUclBo2KB2SlGFnCRiktvmYfFM1J+mUAYJAjVUPV KGr4Cmgk02QkJNqwDv5bYtMhEKyESjURZx3lrUBXz7lWthHBTsMwjk3zXNLXAPny8JuE PptbbNHLILH2MgdkoT7FrrIP9Fnwawq9uOuUbebSnE7seuhXQCv8ONmbHR6P6cEDyIM2 9J4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b="PH1S8/Df"; 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 j11-20020a056a00234b00b006cbf67abff9si11938087pfj.269.2023.12.14.10.46.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 10:46:13 -0800 (PST) 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="PH1S8/Df"; 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 925FF819CC09; Thu, 14 Dec 2023 10:46:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573190AbjLNSpf (ORCPT + 99 others); Thu, 14 Dec 2023 13:45:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573233AbjLNSpQ (ORCPT ); Thu, 14 Dec 2023 13:45:16 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8C68D6D; Thu, 14 Dec 2023 10:45:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702579514; bh=+jS1MLjilnhxRPOp0kqbSSFP9DLnqgTL1iwYC7/xSp8=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=PH1S8/DfkxO1QyDe0AqWW8FTVsk0Kh+JAcJjokfuWmIJ1XIXS4j3UdhaddJCcs3Ns XzQHOBgPOsF+JTRHOv6L4hkqJrJOnM6jtbRPn/8maHf1xjn8eHwqY3vurChFIUx8ll FtTdKk96NeN/4TE84wdjzanPXyIUkzUsp+DAFoJtn1AGNqEhxw0WbTKZuI9EN/iUfZ W5NljOKMiCWg8N4LE1+BZewiYPut6wykWkqZuZK5nUalpzFR+9RZsSxpIAv66cCS9R EZ8uilAs9BmK1jMUUYzyC3QEsNQK3fFjGp4nIWiX+U2AVDn2Fh8NAlH9XXh4ywMKAL wJTOwaCVPXV8g== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 52B9A13798; Thu, 14 Dec 2023 19:45:14 +0100 (CET) Date: Thu, 14 Dec 2023 19:45:14 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Jens Axboe , Christian Brauner , Alexander Viro , linux-fsdevel@vger.kernel.org, Eric Dumazet , "David S. Miller" , David Ahern , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RERESEND 09/11] net/tcp: tcp_splice_read: always do non-blocking reads Message-ID: <2d44f2f64c18151d103ee045d1e3ce7a7d5534273.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: <2cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2cover.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 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]); Thu, 14 Dec 2023 10:46:08 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785284078797175560 X-GMAIL-MSGID: 1785284078797175560 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 Thu Dec 14 18:45:16 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: 178873 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8767873dys; Thu, 14 Dec 2023 10:46:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHGjGaod/aJ5DoNJN3BKnA5EthUEkawINKOBAEeeMDDJ6tZA0qVRgJ66DsCBTrJgiw4m2cg X-Received: by 2002:a05:6a00:1388:b0:6ce:fa73:a046 with SMTP id t8-20020a056a00138800b006cefa73a046mr11809030pfg.50.1702579569940; Thu, 14 Dec 2023 10:46:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702579569; cv=none; d=google.com; s=arc-20160816; b=GaMgNvhkWaLlX6tIMdELMm+8Ai0ZsA8BCkUgWcn/sukhaPFVyioAJEtDF7vLMuNgWA 95KEEt2WVDDcm97aJsEgaJPTwKfkS/DXYDG5MnAXE4kIQPw11izKgqQ/YO0sye5+KQhf Nb5pqk0JhCCph8y+Nzl167TyVao4lWE72URu4ULNE0dHDJIxVs+qbDV888YXX5AjJBwK +Tk/Pkkc/lCc06PmJygS8TCpOh5nkzWx1xPn00j54suNal0xJx2Huo77p5Z983cSJsPb a3k2Ma8WkutwCANSzrDfKnSbN8FjL7CQVa7hMKnomEX6OQtLBjae6o78pkt3ySVeXpy8 Pu0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:cc:from:date :dkim-signature; bh=dOsvCvvko640GyLs3c2ueoX0r+kYs6M9vD3YPA0Zpbo=; fh=F3CYGF5tLt2QRCGz6RnC5dSNkSKVVQOih9/vnGahG3Q=; b=M6LO468CEcwpdORsofRpBrE8An2resszKWNdOLJtc31KFImcYLGTWMrgjIuIUCxUMm GTm5kUm0ddE54wnYLB+F74xrZR3xJIXwMmMCqs59RWhKncm0PIr+izXAiwEy/JYvajIp QdNm7HWMnhtAf5kGesVCUo9gTlZvOGd6xaSGwrgI1UJbdUevW13u309rWEvNln1VOfGu OnjFLSul7qbDjyW6sDEvAxRHx71SSvMbK5k/AJQY7Z0vMS9YJoH49aZmgHLQisYO+vpR PeXdUC6vI+7aoVE2BSUV52rjU+8LIPPAKNo1cFApcWlhYrj8nejmq+JUUm5emZ3UKdrL OKNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=bU9lIeGD; 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id u12-20020a056a00124c00b006cd8454cbb4si11791449pfi.337.2023.12.14.10.46.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 10:46:09 -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=bU9lIeGD; 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 2C81D8200CB2; Thu, 14 Dec 2023 10:46:07 -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 S1573132AbjLNSpo (ORCPT + 99 others); Thu, 14 Dec 2023 13:45:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573260AbjLNSpR (ORCPT ); Thu, 14 Dec 2023 13:45:17 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3FF610C4; Thu, 14 Dec 2023 10:45:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702579516; bh=nDrwqDx6g17tp76N5xVUDx8sUEDcvzOb97eotkFu3/k=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=bU9lIeGDIS4sb4eigHq8GkEC2G0QMzGoWlh/3T6TCHg4E7CiLMx6bQhTrB2uPpk8j ssozwnxjkVhZyEpDAVSf+GeMQ2iDxQaNQB9ZJF33EZtkloiW25yAV6e2kfwdpVNQBg rAo1xySnVgDvdqKVSOX/Hx4LKdqcTnlQaI84JLOg6QMzXXlCbUAe6Ced9wsyGUJjqU ybnPvgcZ4j8Qo80Ln49MG0FiNV3kUv2kbj6z9B/91NC+JUFPl13k8ro6EBaBE/uYLt aYiwtqxmm6DHMe24nl6WsxT3vvR/q0x+MAbHsLbLdGqvfOlyB/Lo/b3On3E8BUVJEp V6V+Z3IxNwrbA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 4786313990; Thu, 14 Dec 2023 19:45:16 +0100 (CET) Date: Thu, 14 Dec 2023 19:45:16 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Jens Axboe , Christian Brauner , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RERESEND 10/11] splice: file->pipe: -EINVAL for non-regular files w/o FMODE_NOWAIT Message-ID: <25974c79b84c0b3aad566ff7c33b082f90ac5f17e.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: <2cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2cover.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 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]); Thu, 14 Dec 2023 10:46:07 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785284074993824989 X-GMAIL-MSGID: 1785284074993824989 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 Thu Dec 14 18:45:18 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: 178879 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8773018dys; Thu, 14 Dec 2023 10:55:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IE94UgkQVAJ7iqh3HxNYo/s5Gg7mpg9yKwKBQc+8wpscOvooQNChqgOuBckLZsIgd9X16IW X-Received: by 2002:a05:6871:5209:b0:203:37c3:77ff with SMTP id ht9-20020a056871520900b0020337c377ffmr2784178oac.49.1702580123688; Thu, 14 Dec 2023 10:55:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702580123; cv=none; d=google.com; s=arc-20160816; b=JiQfx6XbFdkNVpTi2wwZvoIhfzCZknUdgGAR4BUEJrUyZQQchBcPickVNSfijpzLwe AmcpRdr4CuCupVTpcHjDSYDFFhzXy/b1x/hBd/MDg+8vjdUM/Ig3sAKJ+a0kPgJuRWAz PwWbzuKmlCzUug8q3bbmmbZLpashqS+Pxn6ZLLeafeFBCuP6QjjaIibjj2HaaXb3HPw6 qBdtDyXJaIq4QDgGTv3pYclZaNJOdi+ab9JykDf2oI//yhgDRZYRatm7veKFO0fvmtiq VK8RW5+4DomEzAfJyj/5hHSaIHDl6+T3WJqCdNUCYiMKsADpVUCGxgmCqWcl+NAjfz5K pWcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:cc:from:date :dkim-signature; bh=bqT5sJLL8tHWiNe8r7ObHC4+tPryJx6JupUr3oIeUnU=; fh=F3CYGF5tLt2QRCGz6RnC5dSNkSKVVQOih9/vnGahG3Q=; b=xtAjo+TQzp4mN60SE9LJY6eSJw4d9BO/FoHZluSQejWLmNx+0PfK/4XblltDwfQaZ9 vLbSjLrUr9wp00ReAAmDT8WQYMDCWYwLji9mhEkbMvq9N57aj+388/pEshOAD9Ugoeu0 k5Qt1ZJwP6OboHoJZ8d0fYlZd/ZOmnW0C1L0hEUGMVdWliDnoZDxmwj4MHU6lqiig1Op cz42+sec0iVIBmyqQGuDTSX1YRasb3RPra88/MxC8fX8RhIfZMM54LND4y1TUhpBOpr6 dHTW39R9dtJyMktIyx7iqnrz2FtjqV65UONSSc16p/7pOTLxYypYxh3R0R33cxBUydsb AMKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=qe6kFjlf; 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 bk2-20020a056a02028200b005b18b5da51asi7205438pgb.346.2023.12.14.10.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 10:55:23 -0800 (PST) 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=qe6kFjlf; 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 BF786836D639; Thu, 14 Dec 2023 10:46:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573260AbjLNSpr (ORCPT + 99 others); Thu, 14 Dec 2023 13:45:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573184AbjLNSpR (ORCPT ); Thu, 14 Dec 2023 13:45:17 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E02A110CA; Thu, 14 Dec 2023 10:45:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702579518; bh=0Y5aaQx2qRwfXzxGXtA4gFQ+RiU4c9MyNSa/+MyfLpc=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=qe6kFjlfCM7Eq94x2i5G7nSUHxzylJFbomjl/T2NXk9aoSZEafuH5veu/HbgK0JCO cb3CKGuEyFze10Qb4J5LCAgbu/vmpXwsn7N8LluHlAi1h2fZDv1Oo8WnItQTALiuQv mFZO34GK2R+yyc1HxH87BtdpApvjZG/QRX4QgHPFwGy6jhoiDd7CkEi5KWxqtqSm9c VOe9hc4vSVwhoxMWBYcaQ6PoEwok+I2T/rcrVhEuqRycp+FSjjVFaLs3iScLJgf02j 3gL6yRi+psxCcwtJ62pNiW3EGnizxIvAjNxBHPpV1hVXSZYUrCmE5hJS4M5+5EsZOh YXspp0bKJ4rRA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 7D9F21379A; Thu, 14 Dec 2023 19:45:18 +0100 (CET) Date: Thu, 14 Dec 2023 19:45:18 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Jens Axboe , Christian Brauner , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RERESEND 11/11] splice: splice_to_socket: always request MSG_DONTWAIT Message-ID: <2813e1805aa942862d300bec4d0563c5a466dce78.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: <2cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2cover.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 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]); Thu, 14 Dec 2023 10:46:11 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785284655789504376 X-GMAIL-MSGID: 1785284655789504376 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);