From patchwork Tue Dec 12 10:12:33 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: 177220 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7622854vqy; Tue, 12 Dec 2023 02:13:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEwjWFTeiHmeo65EUxD8mP3xadmRYXHxGXA3zzGp67p8PxURP6j77cmQbuqwSKdwzyw4my7 X-Received: by 2002:a05:6a00:139f:b0:6ce:725f:7d9d with SMTP id t31-20020a056a00139f00b006ce725f7d9dmr7400637pfg.14.1702375984991; Tue, 12 Dec 2023 02:13:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702375984; cv=none; d=google.com; s=arc-20160816; b=caQK0huBYRqHesxqiEehHDzXQvUaoleQjFPA+XlMImV+MpKr2D8r1bhbji6l4Za2rE 9lC+N7TApuMNIfYLNkuKpwc6rwfFkiy2KZnicD7qh5nQb5M7q+PZggLevvquOtdghnCG Y21waMasbz2+zPq6Yrqy/zt2fa3bATJqKYE1G8V8DJl68Gnn9yye2NppE+ucjcdce1Mn n/pG7AGii9cIC0fpsrfsjbs+DsO/0EKyciIpMpYYltElAv50CNjCqLIA78+L6Q5TLdeI 3o6+rDu4lQW0zKow3iow9279YDVw5y94S56624c5o+znVyiyWhDT5xPu9uYU1abt69bE ESOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:to:from:date :dkim-signature; bh=djB3UWX2KbdGq0Pa3uvK6+f/xhR1DsgKQg623iEdNbE=; fh=c1hve9LK7bidUltaxotdOOkNtWZ8Drk/KOyPdUWU/OI=; b=CRX19XuqONtXcB9Cdn1F+j79QUWgESKlIlUzUfC3LO6mDqehJboJTgPkgZZDxjspOo KtEQlz3Q/PvLZwNJHn5lcvFw/RuUYmwBXhvz5DpcbtdCSV8FAxWy37fkDYMFLDkdo3wE C4444QecFplwOtCyjxis81IyoXmnCWwEuP8NB9LwnYIftdxqTfefsaDjFCAzCBlUgx2u wKJbKOjS7ljg+dQz6JbjEYrRyP2FxS2bjBSAhqyqBWP/1ybw2cyIwhNKKwcrac7DE5P3 T3H607cx9b5D5QDHhv+4oH53V3XmI9DxyJtlA0BFql+KHBqU11ReXgs32rCqqWnXRvtw m8/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=LJxubxPL; 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 o9-20020a655209000000b005b8ee1c0c67si7312567pgp.594.2023.12.12.02.13.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:13:04 -0800 (PST) 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=LJxubxPL; 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 69B2B80CF545; Tue, 12 Dec 2023 02:12:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231546AbjLLKMb (ORCPT + 99 others); Tue, 12 Dec 2023 05:12:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230508AbjLLKM2 (ORCPT ); Tue, 12 Dec 2023 05:12:28 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D42C79C; Tue, 12 Dec 2023 02:12:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702375953; bh=4W7u+rDADbbJkWobBhlJPUHFhHQq5S7vzstWfOqjssk=; h=Date:From:To:Subject:References:In-Reply-To:From; b=LJxubxPLaxOr7sailyjIGDn+LExkcMhhNvGORanAehnhW0OUH7vKXnHMX/aZRUBtp pwgxidzvWNVMaboCG5E7BVf0/wlxXQnv1ANoTO0NkJAU5jYF2MXmUlOWFwPuJ4+lEu Vs8Bs/hdpJd9wgWhGOagMgmb5jhX59JPPMOTD+E1f6Q3spcKsMWjpUNEsP2xL4uV4X ShEYZQXpsUS3X9co4oU1wyXQs7mSBywQpoubPBOZzlK5HOiogOLpd0tUJrpnVsxPM+ Mobd/QpmVm9el7ZTVtFajy3et27vJjQWjosb8jVceoJzPmZEu3U4/PgC4wCwkZyoKQ 0wa9bYmXe4qIg== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 8357512A76; Tue, 12 Dec 2023 11:12:33 +0100 (CET) Date: Tue, 12 Dec 2023 11:12:33 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 01/11] splice: copy_splice_read: do the I/O with IOCB_NOWAIT Message-ID: <19910c8026500ba43f3d93e66e822ae64980d9527.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:12:56 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945769419789839 X-GMAIL-MSGID: 1785070600729847510 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 Tue Dec 12 10:12:36 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: 177221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7622899vqy; Tue, 12 Dec 2023 02:13:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiD39Sage0atVmf1THMJJZ+aqLHtEqFLwLfEZZic3INwEA4H28GHhAy55SqooqHsGFlHKG X-Received: by 2002:a05:6e02:12e8:b0:35d:4ecb:1752 with SMTP id l8-20020a056e0212e800b0035d4ecb1752mr6180212iln.2.1702375990774; Tue, 12 Dec 2023 02:13:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702375990; cv=none; d=google.com; s=arc-20160816; b=WmgK5vvn6xnOUVjDrjJKkn1LTc9W9X6MxB5+E4AugpLpF14iB3RR9Lx+uVwsMzBM7T k980JvlgJfLpioP7UziI3tesmum0Hwx1R1h+PdOxpg2gjaRnM062R2XHWiHioud4vqQ2 BiwTRY0XwoHDQZrXQJe7Ty6AZgyxUOeuMfvgzPVx1gv8iIVkowD0QXZ161D1rloB9Ag9 r31A/80VcnSh9Cl94tIJ/2jysP2GqYZOK2Plg7cG8t3pT5DmzPaeyd+xudZe9Ie6YYYK vZZtNXW7xDGmLzdwA3MF58ESv67IiDwNPiKVKxjYpruxKfcsxWyo+5Wl4Zxefg9kWxCW 3AzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:to:from:date :dkim-signature; bh=+Ei4THAmUea+efZyxesmaIh4d6/Z+HG43CzkojuHScI=; fh=XPn+9sWV1UKz/+/EC7pfCn5pETG+NlWde6B2C5Nh+d8=; b=zOmGVIRtUqHL4HtOYtfY/ZYK8au0CRyH3uhIJ7cRBzc/havLMrp1EF3PUSvVhoQCrN 1OoUzWRkZcDFt92IGYkS0UCpbvTUy/6GuK6BRQbFt/qqPj+WVxU//cR2JR0Llp/RWtt2 MNX/1LxHfnQSk7VM4vZXReK1MPPczGMtXu3dWODHhp0brOkvn9AO7ubD+H75kHH3u0RU sFWpc8aRMkYhF1nVCbN1HlZaFyckc7dyCxPEvnOhR2P3oKm++Z0B56n2wX0oGDevQkv3 ja6ubUdpb1NrFuQ7AfJWHsbYYZNvLDV8LxnfpIxF2i4EsnVX9BfJAX9VGVVG3ZbRG9nf bnTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=T2SIjZwb; 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 j4-20020a654304000000b005c66a3f3f5bsi7246552pgq.745.2023.12.12.02.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:13:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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=T2SIjZwb; 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 DD91580C5C85; Tue, 12 Dec 2023 02:13:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235029AbjLLKMi (ORCPT + 99 others); Tue, 12 Dec 2023 05:12:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231657AbjLLKMc (ORCPT ); Tue, 12 Dec 2023 05:12:32 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C8C1A9; Tue, 12 Dec 2023 02:12:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702375956; bh=GmhTyoCmHF6HqL+pWcL97O1/nAP/FmrlJL/j4tpBifk=; h=Date:From:To:Subject:References:In-Reply-To:From; b=T2SIjZwbG6EhhNDgN8BPDisp+H0VJJkoYAjObGhcc+zxY6SDD0I2QgLSSeuN6Gd0X Shxww6COV76UAfTxT07ByfTU8S9DVidsI3WxOUB0A8ty488KqwitMerjTvjlX61wLb FePvMbjBLI6Z3ylFOJ6jQShhZTjg8W45kOaJgH+sJ19ObdaUbhkCePZd8jFI+9hwH4 rqMLH1X/14jefE7ZmoA3AUZK7Eru3j9t/mjrurkgWZanJImAGm3UlAAscqEM1BIK5s G76ahQPKcpVvOgrcOHV2Egx45kzthRd6A5I4urr8TGoFV+Xyda8GR4gYImsyPRwqeV I8AV8RAk8BaqQ== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id BE56A12A78; Tue, 12 Dec 2023 11:12:36 +0100 (CET) Date: Tue, 12 Dec 2023 11:12:36 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: "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 RESEND 02/11] af_unix: unix_stream_splice_read: always request MSG_DONTWAIT Message-ID: <18db45d00902da22ae25aa16a0c28bb41002fc039.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:13:01 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945791184450762 X-GMAIL-MSGID: 1785070606465786855 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 Tue Dec 12 10:12:40 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: 177219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7622844vqy; Tue, 12 Dec 2023 02:13:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvrk5av7M2RdnvNZucgXf9HeOMn8DHeMtmcvoIwVvL0Sc5pR764DHlKVHPKL0BPu/EVkkw X-Received: by 2002:a05:6a20:4b21:b0:18c:138e:f268 with SMTP id fp33-20020a056a204b2100b0018c138ef268mr2496735pzb.21.1702375983793; Tue, 12 Dec 2023 02:13:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702375983; cv=none; d=google.com; s=arc-20160816; b=F8YSyDnnykjyToElepyQgSQs/iCR9BrpENqim5Y8dQ81Yx2tbfiMCbLiPo/nE3igYb ucHtL4Hpvrxre4aVZwoBXI01Ta/ZpYOLfdJzhaZD3tlzteRcRAg+VQy4dasRhzC4souC SD4N6IHwvJllNigod9Lrt1YO9r3zcmnagLVIHRldqP4525lNpHoJfFVEJ59fGBtIyapg tGi08QQ5jkZCTVx8kmbEq2Hza69CfoLlCOxvjDbmhb28CBRbMzB1CQcSuN5Gh5dwtUoR 67xFLUrJdR1R7ZTUIrSEh/940vfnFOyyYR7tM1h//cqtLlt1slHc044fk6lyFTf0LKeb gwfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:to:from:date :dkim-signature; bh=4hxzCj/pB+6qdYAPKsT4jHqQl6twbw/dd9QSn80um2M=; fh=fi2GXeEH2RMshyuG0DfCuvmc+bmbbfvakIDlzZ25MD0=; b=YwN72NLvoS6nhscDZLYtkzHC7vU2nA9ljafrLXbokZtwPNT7TS3KcNmRyvMipEEfFO VKcMFw53c2Qu54e6mP9GjpHYXpy41lUeKue5OyRpWE28PNZQfGBhb5eZBmb7xMz0ppnH Xp6TvWJEmNjhjT7SFgCfsfY8BPM3KqZ0cZ06dyxkYIscdCrA+/gWCDSNUWmpDlwEZA5t XUxQCpLj0jl0jjp/yFb5M2YjIQAgfeAOSmHCIJClinLjyioyKho42M8V8AWFDDF0LVlo du/PKUHRuT3wsKGdstdrD9tMUnb+1w+3S4zqTu/VvkDvjIxGPom9jB2QzAOcSjs0w40J u9XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=pw6XLXic; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 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 x12-20020a1709029a4c00b001cff624a64asi7562711plv.532.2023.12.12.02.12.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:13:03 -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=pw6XLXic; 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 9191980A1373; Tue, 12 Dec 2023 02:12:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235025AbjLLKMl (ORCPT + 99 others); Tue, 12 Dec 2023 05:12:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232073AbjLLKMi (ORCPT ); Tue, 12 Dec 2023 05:12:38 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E900DD9; Tue, 12 Dec 2023 02:12:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702375960; bh=g8iY2h+KeEWIRzD4R4jVgCFkjuQjTUqXcpcOACu7ias=; h=Date:From:To:Subject:References:In-Reply-To:From; b=pw6XLXicnVg0zWWuIVngs44b7T+SOpKSunQd3is3IrR5tTKNZGmmpy9Yx+FpMDau2 cswcXbe/DwtzyXjJ+tsb28zfFjJK40Iagqxp7u28lPMetPsSmwb63ZA20QwbbfQcNC 1k0IDx5QViMTv8h4bi6fAsRvvZS72h4dxPOeXt98Tm9bDl0Cym1lH1o816JxSA9I++ 8GvhgjNnVLmKvxlOyFe6kCepgsv7GxaCp8nhCRwoR9mqZWwfd5vbDJ0Za2h4WJ/TRb /2gpXn0nQM+Fi0SFzksbTGyToscNDeoEp/OTc4I3AU7OSyc70MKx48A2Kzna+oVM2J 7/f4EQb0B60gA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 5A2A912A7A; Tue, 12 Dec 2023 11:12:40 +0100 (CET) Date: Tue, 12 Dec 2023 11:12:40 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: Miklos Szeredi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 03/11] fuse: fuse_dev_splice_read: use nonblocking I/O Message-ID: <1b5c5b0a18a59ec31f098959e26530ff607a67379.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:12:53 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945789804435051 X-GMAIL-MSGID: 1785070599794495019 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 Tue Dec 12 10:12: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: 177218 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7622837vqy; Tue, 12 Dec 2023 02:13:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHQmglWFHPqN/Zspe4iYTemV2UPZ5NFzN37OEKcIlH63amqXxDTWE4S75Fip8Ep9GHlNsex X-Received: by 2002:a05:6602:4a81:b0:7b4:28f8:2bf6 with SMTP id ej1-20020a0566024a8100b007b428f82bf6mr6086103iob.31.1702375983767; Tue, 12 Dec 2023 02:13:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702375983; cv=none; d=google.com; s=arc-20160816; b=PEVdGy1Zezf/eVrfFW8sWIo1O2/3nQPK5itjrII5oh2/HNXK+7wk5tFtglrHMjJtf3 KNS+OLeCpK3zRHS2Ind+NU/nCLV5cTieHXwtDY9i2D+OVFklWZbHEwhyJAS2kY9O6XVk uCv/askq9fY/IYcQE5UphWaNj6o3SozUhBYoN1J391N+f/FTeYD4L7fwwJs9xnqoRhZ7 wPVkfxJUVEOwKx7uWZTxEa1Y/j8UG5WDnBySf+bh6T5RYM3u9kXaOokJ7M0asOdHOQml ku+HEaZSS9z5n8mWI1SQ6+MQ3Uija4XB85IQLGlQf/7ORCVaInlH1pGqOyNY+yhSRhQX uIWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:to:from:date :dkim-signature; bh=Yq8G+z2+aXEQXnJTTZhctiOsc2iN0WmBpFdNZqpivLQ=; fh=vfqz4xR+2eq2GDJZ6a73hYxIIN3Txk7hLCBpB3/7d+A=; b=ZoNRRW6N8Dsg3rh5fsrMiXKcuiJVKZDvraTRNoBwiYyh5h93IwvCF2ee5jSQSLUixU SnjXQN8GPgwP49pDkULKVjMsU2T/SjbOwfZQ+K2yote7QQBlZ4pjgkZxBDUgMQMEH2u9 OQo+nSeLe9RGYO1yRNuMiSLmSK5zPu4SichUKjthaSBPm9s8QO43N9nUpayIMgudgPE5 bdMnHnIvJjsR16u8aGlFQTXrUL+gVCz3buP3+8yqdnpFKkMzGaAP7YkUczsAES6T5hQJ nYYgcShQ7HpT5OHa7lpyqt050gic7DvyGoJWACMTnySHB4Nk9+pkACGrR09Bx+P4411m fqgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=OT4OnGfp; 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 l68-20020a632547000000b005c6634fa849si7535470pgl.89.2023.12.12.02.13.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:13:03 -0800 (PST) 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=OT4OnGfp; 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 1B5FB804C63F; Tue, 12 Dec 2023 02:13:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232442AbjLLKMo (ORCPT + 99 others); Tue, 12 Dec 2023 05:12:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235042AbjLLKMj (ORCPT ); Tue, 12 Dec 2023 05:12:39 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC15C10B; Tue, 12 Dec 2023 02:12:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702375963; bh=Lx01uUzZBLjfFlGQlKARFoT+Vf/QEeNIG29aSuy6Lf8=; h=Date:From:To:Subject:References:In-Reply-To:From; b=OT4OnGfpCidozTgeKJqlenrtbf0JerI1R/jU8yP204BjK4j3qeUs4ZqZNwq+f6H// wKV4HqXL7mYXXFJBLq2OKLvweJzrd2nRxE/rO5JGD4Ud/xGcZeyQuVEh6jmP1Udhog F1sTysJ+py9xrbtTHlxfK1QRFaZU0qzUB2Zj4tlnMrRM/ceBvOATJsNlsbAVtek1xP ouydr8agHAM56ic655re4rEW/1CWxSZE2nbSX6g89ldVK3ux4shwpRzDKF+qQVtqQd ph+hT5GDTBF728he4SOcBE2bdo9J9iPxtaP3Xf5qRpwFLPN20bh99gPmenALHXd0Oz N1dY4hhdd8a4Q== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 0700D12A7C; Tue, 12 Dec 2023 11:12:43 +0100 (CET) Date: Tue, 12 Dec 2023 11:12:42 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: Steven Rostedt , Masami Hiramatsu , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH RESEND 04/11] tracing: tracing_buffers_splice_read: behave as-if non-blocking I/O Message-ID: <11b84f2e4e5eaad501ff7b2bb03e2ad2f25ecdf14.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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]); Tue, 12 Dec 2023 02:13:01 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945788622854908 X-GMAIL-MSGID: 1785070599925113865 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 Tue Dec 12 10:12: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: 177232 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7632214vqy; Tue, 12 Dec 2023 02:36:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvA/Qxpu2td2TKNjCuipnnW1Dw/cZjRHhWke2KDlvDQn+rJos0Is20QM1e+i3xGjWpYukB X-Received: by 2002:a05:6870:ef06:b0:1fa:aad7:79d2 with SMTP id qq6-20020a056870ef0600b001faaad779d2mr7038954oab.14.1702377387106; Tue, 12 Dec 2023 02:36:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702377387; cv=none; d=google.com; s=arc-20160816; b=0mik9L+4le+k0A6CatZe96K1/r9o0D0VvV06sH+cmGNYfx0oxGaScNEURQ3Dpl64jW 0XJBAGqCBfUHMul7IQuHY+LxzmCVU38iXOP+ir9c8YiCdIUDtlw6iZ4LxfkxvzN/MYlR ySmpStCmACyUwICC8zzrpG8crlAwnelfWWELyIS/HYu9kKX2QYk39ycH1UlUWXTcA5wl i2jEqvUw07/C0VXnho2VnXwcu2U2EHbKDySPHNgfWghd9PagKgbJ4d735TExO5iXtmRs 3p2xH4ZGhMwvMoDk/FETMy+Mp5PpYVPuZja4osqjbpJ7uFG7O2puzaJATA338swI0b7H LQwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:to:from:date :dkim-signature; bh=w1cJAF0mfjqt4YJReeldSqLgO24uRvVIGTtmnulln3g=; fh=PRK3jTUt9N5jyBQTqAuE8MsqYFhEmwIUMV99uXQgzDQ=; b=TyyzrMAcK9WZBDka+xmjWntcAiteuWFXl/U8HjSvWFyp+1uOJ2zsvYhXeHLxyVazVE bPKizulBwLXHmNxn4izMXOVkDSdRQRp39Fu5/UrUna3JAz1glN83YQKTcz5jArw0h+IE nIt+0jI6lHGo8o40NlXwDbesBjHip3iUCfK2JprMzTiQzDhCEfX9pcwzjySbJyaBYCci RRu6G0JETP3vws/+ed+jrDwxaviJRo1Ja6aHoeWJdyYcHT2MMI+eTj+sbyv7BB3iP3LB 5nKdlvj2L7VVPzPD/q4SVGqy6N/1WBndZZ3vSLtJmTUfJa1sTimnaEl7rSU4xI5R3uHW prcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=BwRRiYuw; 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 z19-20020a63e113000000b00578e0ff59bbsi7553855pgh.865.2023.12.12.02.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:36:27 -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=BwRRiYuw; 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 33B98807E420; Tue, 12 Dec 2023 02:13:07 -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 S235062AbjLLKMr (ORCPT + 99 others); Tue, 12 Dec 2023 05:12:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232401AbjLLKMk (ORCPT ); Tue, 12 Dec 2023 05:12:40 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4503CD for ; Tue, 12 Dec 2023 02:12:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702375965; bh=r6v4V7TG0K5QA6721m/OqT6YeC6Z7JGT8NJQG21F+Oc=; h=Date:From:To:Subject:References:In-Reply-To:From; b=BwRRiYuwPmzotudPpKPH4azD87QWkZGv3a2fzKAHjMSCxM0ceqS3BCpmR7J4T9Spy /TNZvnENBm+IIDdipEsGERTB9XZkUIFBeHa87JDqHe2eH47bUZ72B0qT4gCluS4k9E lI207u8gEPCIUwumwUn4BLpmx8WF4D5+5Pp6OHoq/e4mcDHx3+xjPSSAcyfvU4sSKY zqnQtSsdfPYIMtq9DmNIKmB07Rkx18TxfG3+9rAoW4zxXL7i0IabYD0r8NhAIlkJq9 5eCAKpYUhzT+W2rSuIh943f2MNGUmuTTdJNMvG9pmniXuHeH+vIk+Z5mrEmhSnmtRc goBjYag/0Ec+Q== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 9737512F6E; Tue, 12 Dec 2023 11:12:45 +0100 (CET) Date: Tue, 12 Dec 2023 11:12:45 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: 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 RESEND 05/11] relayfs: relay_file_splice_read: always return -EAGAIN for no data Message-ID: <1329ea2aecb56e982f16aea7c637fd0e8a7985506.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:13:07 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945791515754256 X-GMAIL-MSGID: 1785072071093684915 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 Tue Dec 12 10:12: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: 177222 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7622920vqy; Tue, 12 Dec 2023 02:13:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUcQ/J7s2bK1j6SfnwGq6KvwGGiLOwI8duuqEo9MXsDKjsmHuxfmZWH3BAJgJCfjlxYalx X-Received: by 2002:a17:902:e54b:b0:1d0:8388:3701 with SMTP id n11-20020a170902e54b00b001d083883701mr6785136plf.100.1702375993123; Tue, 12 Dec 2023 02:13:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702375993; cv=none; d=google.com; s=arc-20160816; b=ikHxTWc/nZMc1l/Xqy66nbCRv+NeVU1+8Sb8epbg9ym2+eGN5P53jw49xc3G6T6SNG IulaOxmcWJinT1PVEAOiN1v7/lEDfXB6o1oM5gds+A61XK4h9ap7Vru/9T3boJH8gMr6 VrJibKz+Dgd0OvjMc1Rp+nlw1I93CCEUeK0bgNs7g5dqKu45KazM7EFKfy/KIFNhXQeW 5vlPkErMkL5Md+wREk56lrD/2XUwFmJJqUy6qY5FCF4mRjX69kqzl7/OeacRNcQ6RWIu WfIBJxa+waKY03xuOa6HUu0GRggif3wl+6LuC8P1EGZhKBOVbF7kWsCLZdXEjmUx5ZCz 5fcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:to:from:date :dkim-signature; bh=2r6lkTF7Q8AzDnXTXmf4yvO5J8JKt+BBhlVnARKHnfs=; fh=2kGGRIvJYyGGbVY4r031iRsoH1deMV8sC5746c0W6HI=; b=wo6Lay7Ch09BzjsMUg5OqyusqS5D8FVufSeUfeM027QD0pP0viNLyuCs52ETfDkLOr mqNrOShnz1edCTAUBrhqa/sN1pT2Rl+CGcR7fPwJaED53ANeLHxNUCTGQZbD/DkYbhFe nh23NJLnO3JS0oqgKS5BnjvwQf3pphZfqV8LzmzFbU2uuTEEgSkf5R58cQADlOzI5riv PKosyP9brbsbDQfwg3iWwSFnviyiAOvtD4rAK6nUxS0l5FxQmV+chAG8MtNKAKk9LAwb N0R0iIMOir161xZS1+jlsIIK1NlAX0vCBHNQ01RZaG8tdFwk+DUBebwB83jOAgBNpzo8 wnCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=pcF+kuj6; 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 q17-20020a170902dad100b001d08f229049si7716671plx.406.2023.12.12.02.13.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:13:13 -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=pcF+kuj6; 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 55DD9807DEE5; Tue, 12 Dec 2023 02:13:09 -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 S232045AbjLLKMw (ORCPT + 99 others); Tue, 12 Dec 2023 05:12:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235041AbjLLKMn (ORCPT ); Tue, 12 Dec 2023 05:12:43 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7FF7AB; Tue, 12 Dec 2023 02:12:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702375968; bh=096hm9ZbRaIMymoQ+0IpHZlm7YvNfwIQuC+ov8MZpxI=; h=Date:From:To:Subject:References:In-Reply-To:From; b=pcF+kuj6twjNBVCUPQGeJb7my9K+1VvzXPI0J25y/Gn90LiGBj+vWoJl83uX6lb1c drs17TVTFCzPFW61iLjrHsYql3GXgVOGa4GS59KD5CTSYTil8N04Ji6qfiBkifNl95 WVcAqudZmxTivJ/eyROH+eHu7ayTS9fiWEN5RTS7VzNdVfNC35s7HvYaUvPSEW6IMo +HHE69xVjML13mdXERyD1TWOOO692oiH7EH/R7AB/nR5ZuNbnFeSHkgPH+E35j5e2D TWjapYdDV//LfS0lZyRU53O3zVjVDdfJc9a6ooJK4P4coQCGrLVRr03uNRRkH8fjHV Uz+qHlhE3q4Cg== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 0A9AA12BEC; Tue, 12 Dec 2023 11:12:48 +0100 (CET) Date: Tue, 12 Dec 2023 11:12:47 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: 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 RESEND 06/11] net/smc: smc_splice_read: always request MSG_DONTWAIT Message-ID: <145da5ab094bcc7d3331385e8813074922c2a13c6.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:13:09 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945793182861719 X-GMAIL-MSGID: 1785070609213425510 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 Tue Dec 12 10:12: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: 177227 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7629650vqy; Tue, 12 Dec 2023 02:30:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGYsaHHdXznHhN/IOCPeEE3D9Ak1+qHajKUrCa2W9207Rx7uU36/CwP1WNTOsorlaGX+HLQ X-Received: by 2002:a05:6a20:560c:b0:190:2d3d:b08a with SMTP id ir12-20020a056a20560c00b001902d3db08amr5632605pzc.18.1702377013092; Tue, 12 Dec 2023 02:30:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702377013; cv=none; d=google.com; s=arc-20160816; b=FrzneJdrRCXiW25gUT1Gkg5wu0BXOn8D8aCoDDLoLAUZEtvYP2ci/jny8vvk6okP8q frBZsXjmVEhI//S7E//lQ3lJUUvkcAVYOfzZhv71Y67st9bOs6zy2/VKA7wuok7h9f5Z Ju+/0ZIHU0EYroIMFKQXuZAhIeU39N3CeCpqB3AOcH1OiRgxCKE5Mj5RVSoh2LXWnYTP +n7h9tkbH0aWr/5OBACX1nLJSUzMkj7oWZF0ZgWYSDnUBWcGiwA1IdXyLxSS1jnB+ZfI NHLB/OfQvUBGt3PL+HKr1iKMARBmTdMb6TZGgHxVndjGBaO77/8nEsneUmXbe5OE0vXL da3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:to:from:date :dkim-signature; bh=A1O/4e9vEQAIjGbeCRFtsv1F54E0Y/A0ofQaC63Gu00=; fh=FKsHAEOkN5oNsabLtwd95oXqpBlzSJ1ELRHiC0E/PQ4=; b=zJAuTasYSz3njwWZcndh0kW/2Q/elEHI6ojZEXhsO0IgCcDjPPbYGXJMFud7f+79Hr toda+VQ4mZcFAp2MN/C6PAXs7lYmy1TPrgKOLkRcfe7u1trFTPh12u4wF4GxGZT4wQyc G6BW9RSp1rX+02l1NEqpUeatkzorKgVZDu3BEog+Q63+200FqRTdDhb2iIoCH4gRC4XA 2orEuC+ZB+K7UwjjiHaWgGdHZnBhZ3DaNBjXRJZKZH70Meud77H3hPpvdINw2hghrVcC cupu3JDZliJhCam2uUE0MkSrIM0u5AeBedPqy+GUUYm1JVFOfZTg14aoYW2w3JHIJ87V Qeiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b="FP/x56Va"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id m12-20020a056a00080c00b006ce5b632ff6si7748916pfk.54.2023.12.12.02.30.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:30:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b="FP/x56Va"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 582028054B4C; Tue, 12 Dec 2023 02:13:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235128AbjLLKNE (ORCPT + 99 others); Tue, 12 Dec 2023 05:13:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235081AbjLLKMs (ORCPT ); Tue, 12 Dec 2023 05:12:48 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40871A6; Tue, 12 Dec 2023 02:12:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702375970; bh=2AjQrGaQE2NFW95434lGTrYs+KkaIhT6LEOqbOxH2XE=; h=Date:From:To:Subject:References:In-Reply-To:From; b=FP/x56VaAun1w5xQh4Hbyto20YJcWvMPD8ZHJrjx09XvBZpzreHcprde2BPPiSh7f SQuMPVWIkB/XlJlmO/ZMy9/NkqwPeBkxhBOgq/Os2QPd76qII1d85tKFxrzZo6P5Kw mEDW8Q1Awmc2bnP1OriY1L3lCYWjiYq+OMzr39ZsDheSA03CkQttrMXVht5YxZlfOT YMfM6YJeCVMog+IDXMi9842zVLG/4+MIvnXjeCH6SCpyRcKIFGcmBZagddZ6tVPNDA UmSuSbr4RGo703hrZ0pwHZIE+F3Opsci4hPL0LmlwNCVbKlKBI+n/xdo2U+EFw1TKZ r/jmVHoz08amA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 6961712F70; Tue, 12 Dec 2023 11:12:50 +0100 (CET) Date: Tue, 12 Dec 2023 11:12:50 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: "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 RESEND 07/11] kcm: kcm_splice_read: always request MSG_DONTWAIT Message-ID: <1b5a634f5fe1a89d42a7a4f91316f888b02ca576f.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:13:14 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945799524740614 X-GMAIL-MSGID: 1785071678995001127 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 Tue Dec 12 10:12: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: 177228 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7629827vqy; Tue, 12 Dec 2023 02:30:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IGF+7tteKt1BGbE/xLvK7/XtTcBIr3Aoy2x/IujEWoZayrm4ifG94USVSNX0/WxkBFLpVpS X-Received: by 2002:a05:6870:e256:b0:1fb:29af:7359 with SMTP id d22-20020a056870e25600b001fb29af7359mr6799420oac.81.1702377032556; Tue, 12 Dec 2023 02:30:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702377032; cv=none; d=google.com; s=arc-20160816; b=TKXwnL6AhaU9pXcntdBlod7CyIXk9Z/avreOvrusSfePpNVaBmAB4eFLPH8NCatd3a ShcXwhAJlAKgkJzxawa/CSfMtaikayKKGKPZQpQMBShkrnsRzf4DMrd92aMQ2Ic97y2o HEY3pnSu+ngwyuMJZ+jn2E31PmlBVW2F/ZXhMvAzMUWhBx/zV6VRtEj9I0bQaNM2rvAj tJVZ+DxziEe9sR1I5Ihf7eGrDtw20sYP/EaR83Yc6aDcpn+MkOmRX/wyvyktVPGNLGcN eaG3/dBpsHVHsw10A+cN3Y1f82pCc3qyl1+hcN4oeS9Rq+uxi6f9yA6opNMkbe5+lvkQ qPBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:to:from:date :dkim-signature; bh=GvZLqtGiAD5HV6WRcuoSK/eswkcxzJEDfPXTlf1JP2o=; fh=vH294dK40jZtN0IvUTUHO0iQSmz9++711kFjPkjy0zk=; b=ri8/Eg61FzGaxFf/B57wms/H+djY6LQNY4W6QcpQ10PWykAHzOkAeZo3KZJP3+YalJ 3Y6eGiAPz8JCiS2tk1vqV84qfh3eDSMFnpTs64axKV8VPH4BVq7VC++P8xVnVvqNbdSQ r/To5rJVc0bbrmKOgwxF3souPXNjWFCJPcHaU+Balnzpc6GY+qIsk4TZMeGOsindPKT5 evvdlvNEp5UooIP/f6uMnaM3DVVki15rR+tvJ7XKiDx28TFp2YfW99gOtLkyBddvKMe+ wnp39a1zghmsIiS83uSLghPXzS+NPaXcLuo5YzCxP0F/LIiwGWkeLtKVqnTFrUkywa9N qpUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=nP2cTzGK; 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 o62-20020a634141000000b005c6b955fb89si7653217pga.204.2023.12.12.02.30.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:30:32 -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=nP2cTzGK; 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 B22E280A1482; Tue, 12 Dec 2023 02:13:35 -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 S235084AbjLLKNL (ORCPT + 99 others); Tue, 12 Dec 2023 05:13:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235061AbjLLKM7 (ORCPT ); Tue, 12 Dec 2023 05:12:59 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CC61136; Tue, 12 Dec 2023 02:12:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702375972; bh=9LoORs0/qovVA+ZuFnVynVHHVy98EiReKRC+P8F39/0=; h=Date:From:To:Subject:References:In-Reply-To:From; b=nP2cTzGK93uab8yPQH14o6ln9eh/KHNoV9MN6Te0tHISKVXk5z5KPgksXxTIofUvY YgDGznUPcymXrcnLSO4HnyTwMODzQMY3WUzzvvehMPY7gI/JfZXkx06yiZBM1eHJYd mOtSGSlcWzY7A0HqYCRUr/By9lswuep07pBhj9mQAmnY1a9hEbU3b5p8bttVQ6SnpV LUdSjHpiRTjvg5RCla4TdpkmGA6Gn4RQONy0dtQbpk5kbV5nLm8sZtFp9V42S4DYW7 165rsI5itIXdfiJbZLVW3PFIHCxRLONRWyb5+lpUG2VVNZPfpdD1Cjeq3499C844xo tN8WXdYrbuBnQ== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id C5BE612A7E; Tue, 12 Dec 2023 11:12:52 +0100 (CET) Date: Tue, 12 Dec 2023 11:12:52 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: Boris Pismenny , John Fastabend , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 08/11] tls/sw: tls_sw_splice_read: always request non-blocking I/O Message-ID: <10fffb097b4d2b328ef16e7353d6829f1ec9efcae.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:13:35 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945798902264229 X-GMAIL-MSGID: 1785071698920099211 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 Tue Dec 12 10:12: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: 177230 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7631902vqy; Tue, 12 Dec 2023 02:35:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGHCYiCdddarK+0Qo9SHW1BEQZbUmPHBShEdH6K56PbcPCqIO/RxMdrEgiiehGIgoGWeiCW X-Received: by 2002:a05:6358:6f13:b0:16e:292:2af2 with SMTP id r19-20020a0563586f1300b0016e02922af2mr3593768rwn.21.1702377346641; Tue, 12 Dec 2023 02:35:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702377346; cv=none; d=google.com; s=arc-20160816; b=fN2tezMlr9MAMBtQqW+hQ7YgfBx7BntzTcNXLQCQOQOa06dZgRupyWM8mbTNbGjHfp rmPnXjAOOsGtSCrcyXQ3kc6MFzvWjb9EgqEQlgiPBZGaMeF0YJqmKbAVc1/VgZXq1DHn TrEcIlSl432q8Ks+Z3wCHRxWuZZAc6EwJ1VHL8JngpayQM2KcdrFhwc7oss4OID1LLnJ C6ieMIbra9zvy/oilHO1TXhg3HiRyjIrwgqfiOaR+WXZF290Y/xDESkmnn46bW2iMc8Z LSqpS8yiS6u6+MqGAsgCy2PYcOHKYoBcPOQIq8wrq/c9aA1eLyPAdk3OvMTTmxTxBzAC xzmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:to:from:date :dkim-signature; bh=WowseLxM3sMriXOaNik9bwsKUT2vlGaFcn56a2+eSF4=; fh=cxCXBaCpufzlnAsKLdrv/dJeTiquqeHLZm8jhAOM4Qw=; b=GDr0T2ilYw1XATc/6QlO3maK7uch5U77GVWBjfGoxzqvD5LTil8gzG3E7uRfPXrj+N 8E8HGduXlQuFlNcZvDUoMxpR6Supo26mCq1isdoZxHOerrsmUKBwiQISiDihsaAMDxZC dlmnKamEPKergiQuuJ/MRQQ9vIH8aDDavsarUXcRb0t0P6xQBz1Y50Sos8KfwbK3wADC atD4c4PaiYpf47dFAoEsZFj0AvZwvo2BvCM70aSzVhNkK1g9Sr3VxzFfKt2CGxRtTPyR tJJ79WC0tKMYn9i5Ex+8l7hv3I7i4miiO+JU0sOeBngne6QoGYuwrOWPHFYPAuKKDQ7C uz3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=ZU9lbK0R; 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 a24-20020a17090ad81800b0028acdc91d4esi152734pjv.73.2023.12.12.02.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:35:46 -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=ZU9lbK0R; 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 D91A080219F9; Tue, 12 Dec 2023 02:13:26 -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 S235134AbjLLKNO (ORCPT + 99 others); Tue, 12 Dec 2023 05:13:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235089AbjLLKNE (ORCPT ); Tue, 12 Dec 2023 05:13:04 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 531CB19F; Tue, 12 Dec 2023 02:12:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702375975; bh=XiOBb6P57asxhXUqF6o8dX8NQpgZ1/qlFGt6+205E9w=; h=Date:From:To:Subject:References:In-Reply-To:From; b=ZU9lbK0RZzdSsInvI8z6QMcZ/XDf2Hc+ZSU41pM7IAWZzlT5X1VzbB3bzTqqhZnsj HpZAPs1CvELOwffrO7yXxL4+mebVIkgC4AMBhV4yggThKpbfuMhxFRIrxO9hDLbiaU kqvDE+0uNlpwgs04+0H+h0kczUaF8hzPO2+XUOM9MD76VysjRpK9Hl2lHq+KX7F/lf OPGFZUtMau3mPGvCn7W1YSDAZqB2uQ79ViMR62wNJPD8pa6NCJM6M4QatgZCANjMVA MSNhZKZUXZCCS6vN9g4iTmnLYtpWZbsVSOAo4crQHompF6atfDC4dPcDcrSDcJ38RE NEPIz/z31IdsA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 4F3E413780; Tue, 12 Dec 2023 11:12:55 +0100 (CET) Date: Tue, 12 Dec 2023 11:12:55 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: Eric Dumazet , "David S. Miller" , David Ahern , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 09/11] net/tcp: tcp_splice_read: always do non-blocking reads Message-ID: <1d44f2f64c18151d103ee045d1e3ce7a7d5534273.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:13:27 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945827179300182 X-GMAIL-MSGID: 1785072028866013143 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 Tue Dec 12 10:12:57 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: 177226 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7627848vqy; Tue, 12 Dec 2023 02:25:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGXW2lzHcOAbagfRvnORdOpday7nMvT/rMakVyMp/PNuEXCDN/rkufONIlvYy9a0hqQEi0 X-Received: by 2002:a05:6870:b69e:b0:1fb:75c:3fdc with SMTP id cy30-20020a056870b69e00b001fb075c3fdcmr7767640oab.60.1702376715943; Tue, 12 Dec 2023 02:25:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702376715; cv=none; d=google.com; s=arc-20160816; b=TX1Vf1uVEcf7ByzlTnm9VllEZ8DusJ8WG7/mtnG2C76+iWuH2s9Q4M2eN77h8FbDHN iJJ42jPL4No04dwEj3yAXyL27ENH6sEvwfqETErpPEE4nwJzDQYnGgPvjN34xR/g8Z1c UBKOt5lkBVI0vup5/YhDWmIHanduzRxF7dtNrWdnNEZZlUcWFzM1p4uBN2VPMUeOQmjI 1oAAN0dLNviQq6PqtLS84w0dJcVMaJkO7uwEQBG6Sr3rLw0VBrdzxOzGns7P82GSVI3U flEc1tlwefZTBK0s1D91Gqn3jdVBsRDGiozBc5CPT0Bj7+/UKxot6q8Qdib1e1Ve+R03 w0gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:to:from:date :dkim-signature; bh=D76F55ANdy0bgWlY2OaYu03oUjSczmKbC4DwH9YTUI0=; fh=c1hve9LK7bidUltaxotdOOkNtWZ8Drk/KOyPdUWU/OI=; b=YkST1GdEVDaalhhDFKzK9KL+prMX8dv5c/R2z8LML3Hh3ykt/K02+F26sSzeVdSUcG cwUBtjfpZF9s4Quu5G2czJeH8D1OHhA6oIVz/YgUakPXojBMeluvhS2LMdrD0E4hUPvu uko9l5dA7DbOIs8ALLT+vnpymYA7a6UmTw+SxMvO3DioNAbnNrxHsJtPpqkr8MOT6LoA FCA6h0MVejfx47hjy7YFAZyMdU3DXEpCjoV8KonY3Qfrklw/DeMqqaWihrBoeMi8hyAk YpiQKGy+6nWD0F4SIt+CffLoc51fHOEJeBZ+3UQe/b3Q6QWQaOD6CqOnRFETt+1IzIkp Nvzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=dbOXt0fX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id b9-20020a63eb49000000b00565db2812a0si7565590pgk.60.2023.12.12.02.25.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:25:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=dbOXt0fX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id CF4CC8054B56; Tue, 12 Dec 2023 02:13:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232442AbjLLKNR (ORCPT + 99 others); Tue, 12 Dec 2023 05:13:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235138AbjLLKNF (ORCPT ); Tue, 12 Dec 2023 05:13:05 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B72C10A; Tue, 12 Dec 2023 02:12:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702375977; bh=vAk4SO4174j23/YAeB+887LjqaZL3bPNr0Lgpgmz8Yo=; h=Date:From:To:Subject:References:In-Reply-To:From; b=dbOXt0fXbgSGzj0VKyKA8rPuUcws7V4+PXn/drjN3ykVlSvzAMXIeBrAC88PRWd8K NFKzgXoQiguXHwRzHQvi5KPzdw3YhKv5kUTmltbJetqef9LolBZxutnKsgf/uBT5Uw 8Fj4RXMQvYY++5i9gVtI3kr/q7rwxWPI/LhUi1uwBZYQLm/Z7miTdtgEiBJcCQ4tLz H2DiukQB0KJwDl3vVgnVnSTNH7VoT/MfDLX7aNysDOtS83YJRZbaIayuZp5xuqoft3 5vkfJRg6xcq2i9+NgN2ShqqICr9fLToud0dZ2Oe+9k8xhEFvQ6O/P1KTr1ec4b8qYw Z9+LQrgBinSmQ== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id DCDF113782; Tue, 12 Dec 2023 11:12:57 +0100 (CET) Date: Tue, 12 Dec 2023 11:12:57 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 10/11] splice: file->pipe: -EINVAL for non-regular files w/o FMODE_NOWAIT Message-ID: <15974c79b84c0b3aad566ff7c33b082f90ac5f17e.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:13:48 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945812061719191 X-GMAIL-MSGID: 1785071367265731952 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 Tue Dec 12 10:13:00 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: 177231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7632128vqy; Tue, 12 Dec 2023 02:36:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLJshOcCzlPTM55pajL6+/Lc7BOx2n9IbiR9ZgmDj22aQtoPWtPNMC+Crj5lq0ZiYlRIdd X-Received: by 2002:a17:90a:fd0e:b0:286:d8a7:f326 with SMTP id cv14-20020a17090afd0e00b00286d8a7f326mr2872946pjb.78.1702377374048; Tue, 12 Dec 2023 02:36:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702377374; cv=none; d=google.com; s=arc-20160816; b=0vda3NKCzPZ/Z9NTlxBPNj0wns0koztm27jAKjsnBXnvidM923FvpWmstr9HqbYa9J NeYa7L9eBgFtLW0ujcyLmQF89OvKMiQqFUBM23Nm5y13X2KDVdu2oEqcr698NVu/98B4 cf3mNVQOdn1eNZvSCEFm7pP9nEdb1poUo1IDhD0WiiN9Lq4JZtxIN0i3pDyF10vxqJBq 8UZLr7yZetRyTc1O1xehhJlzOe6WifBEVuFHCaOXPTGBDcRNdfFvCEq/SSwHou7XcsqC HnymRgOVg3lqQX9J8FPEkUA7D+0i8dYiJvJFIqaPxTqflYud5/QtxlPf2jAmrZLYQKXW taSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:user-agent:message-id:subject:to:from:date :dkim-signature; bh=5mz8uJ1Jsk8cOqVftZwAGmeY14BRr9qL2mwu20mVO3U=; fh=c1hve9LK7bidUltaxotdOOkNtWZ8Drk/KOyPdUWU/OI=; b=gNXWVYLXvxlMqNr79NblJZ3V+Hf8PnmSQPStiYJ0ycUd1s6WU+q8SB0htvDMCIWC4T sMUDsR4CY5J7RJKjU4xtEtja+0q6Qo+g6fgNNxkUVzVQOSW6TsGK/dD3FdpVTHsQoiOF OClyXHBlgdYZbH6ltIgPahbLW4CDTeph5t04keE7CISt68AekEiSdZ+SGsJCth61QgIh 2gcQzpjy8Ip4eg848AplzY7NysDhzG05TBslSu3VIrWHz9GKHBzhkboHxZ986FISBzIS U4uLdLH/TVov5EGAztcxKRveh869uolTF4EtjRsjKBkRjTheRwPnqNSNPQ9QiOmmGj3w KDFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b="PWAYJ5/7"; 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 x19-20020a17090a8a9300b00288654f292esi7717780pjn.20.2023.12.12.02.36.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:36:14 -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="PWAYJ5/7"; 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 9041480219FB; Tue, 12 Dec 2023 02:13:41 -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 S235155AbjLLKN2 (ORCPT + 99 others); Tue, 12 Dec 2023 05:13:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235110AbjLLKNI (ORCPT ); Tue, 12 Dec 2023 05:13:08 -0500 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38125D6F; Tue, 12 Dec 2023 02:13:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1702375980; bh=n8Tz0tvGMgfdPFnvnOzQj+h8yUtCIOndgwGis4T/GEQ=; h=Date:From:To:Subject:References:In-Reply-To:From; b=PWAYJ5/7wGUdmHMz7N8QIQ4ekEIZwUOQDYzI8AfNrITIDjbYq/1SNBNUO6W2SXSRv hHzG6JjeJdhYvhET3HtOFwVx7kZpYdfNJb0N4PNZ4Lf5NS72RwZWqsE9VCRHUT4uNd VU8uSlJz1K+dzahePgbnKs38jkUTqmiYE7P3nYtFQWaCygmhG32bYliYjHHmTlG1KI mdDKFVuCqnSLSBu2vIkOS/9tA8a1SdrvQL1HJMFNmq1Va+zTspvwE0iEUB2pP7/5l+ ff1OarfhS7x54MiYVFBlTqGta7IxiFzcLEVZeR2JDhYw0QUu+LL1fi2GoLbRIoy01Z 8/hsDv3xIzpdQ== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 4061D13784; Tue, 12 Dec 2023 11:13:00 +0100 (CET) Date: Tue, 12 Dec 2023 11:13:00 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 11/11] splice: splice_to_socket: always request MSG_DONTWAIT Message-ID: <1813e1805aa942862d300bec4d0563c5a466dce78.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20231103 References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1cover.1697486714.git.nabijaczleweli@nabijaczleweli.xyz> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:13:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779945827906504267 X-GMAIL-MSGID: 1785072057150178033 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);