From patchwork Tue Jun 27 20:50: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: 113602 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8464350vqr; Tue, 27 Jun 2023 13:54:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5hdztkp1btpE9K5dhXQjH9h8Gkp/1/gbEiIcr6T29Kep/uWtDYej6NerWFn+AVtdTlwQDJ X-Received: by 2002:a05:6a20:7d96:b0:12b:f44f:bc98 with SMTP id v22-20020a056a207d9600b0012bf44fbc98mr1196855pzj.21.1687899253398; Tue, 27 Jun 2023 13:54:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687899253; cv=none; d=google.com; s=arc-20160816; b=FGAoeN7EUQF43Bl9aPlgzqMMARzIvoglqtl+mB9hysJIXRRdn3YyPy+0Ium90xaYIf im3X3hh9AgdmtflwJs5fEuxn62Csk6ndxGFydJXNoy/fifmUtqlrNVaLvQBFHlYRchfu Ef59VxDOe7Mgr+Ajf/Qx91ES38PHudoFeuQ+EYLoRkhzijPc7yb1+OcmXM2aKO9L0vG5 HAPBzSgIBbNOxhalqugqx10rJCkPZ88WtteeXdcuFEpzzKnUINmF79cCtYtQOdAmNO2J MZ1LVpJSmm4CwKinq3SixB9R7985vQldDO6E1IPFnX9QYcvFTrsFJIjNifCXWhjOgvLW 3M5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=P8ekdkgBH92tA9Ly0VzKRksCfLz4wsaYbX9MRQxlGKk=; fh=EwHFucLs4bwDakTQKl/ndDudi5N9htFCanErUntz+qw=; b=CDyiRGW8tCm/G7/TG/LHwDPDTxz0wTspTumbTawvB61e7VmzCjjbOrRGnj9+SN8Tm4 AXgH+jGpdgmQ3US2E+l0mASlwoCAhWNwOJCMErJjBuRem4k9VujXpL/c9Z4n4kvVERH7 +alqL6ntOEcy8IUIoHNZ0/tdM3Q4fCDNpI03VLleMpqiwhzKNpCkAnvEE8OoBw1/ea/p RQunHsV0AnBSGjZCIDEGPoYIV0suUXnqbRnyzgJ9jpPBBvBZvAQ35FpdTcpw2BvSe4B9 dWt+M5R7JukrfnLPDr8QU3GmIQm5GNevSyslm4CLhrfhmzQHe6+tcJ8gI5MpE5ep2+g4 BVAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=c0yE1oTL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 201-20020a6301d2000000b005347d133470si8101233pgb.385.2023.06.27.13.54.01; Tue, 27 Jun 2023 13:54:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=c0yE1oTL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nabijaczleweli.xyz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230420AbjF0UvB (ORCPT + 99 others); Tue, 27 Jun 2023 16:51:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231504AbjF0Uuz (ORCPT ); Tue, 27 Jun 2023 16:50:55 -0400 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 92EA9ED; Tue, 27 Jun 2023 13:50:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1687899053; bh=qCdQpza0vGDqNSdxaU8DpurpP2cGaeH8ooUq+QibGG8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c0yE1oTLMDmySbdvOBrMfwjecFrriPS22m25V4FrQ9pdR/RLc0J93Q3wNpU+YwTMx 5eegks9sgfjtmCD4RzXALcaMHBXL6L+zmZ7YgPOofSKJYravKbeg/2UnKxmzuTfxAK K16wd4fd9eIAoXfm+ZW35dh6NI3E14NjI0yz3y/WS7sb2wVDUIUaHgjMMNGhfveWw1 3vNqt0CseE0IcRJWEdHxiY0IQGuIAe0KahxXq+csSiAvUr9OTWq1TCckCCdxRCqyRA 8v5XvojpVaDT2nn9XR9eybkbzh2+MqZ5sEYH+wOjf4mrVCx31aFDxTGbh51yaZwS+F Rdl6dG4WDtWSw== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id E0BCA12C6; Tue, 27 Jun 2023 22:50:53 +0200 (CEST) Date: Tue, 27 Jun 2023 22:50:52 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: Amir Goldstein Cc: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Chung-Chiang Cheng , ltp@lists.linux.it Subject: [PATCH v4 1/3] splice: always fsnotify_access(in), fsnotify_modify(out) on success Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20230517 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,PDS_RDNS_DYNAMIC_FP, RDNS_DYNAMIC,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769890647510803660?= X-GMAIL-MSGID: =?utf-8?q?1769890647510803660?= The current behaviour caused an asymmetry where some write APIs (write, sendfile) would notify the written-to/read-from objects, but splice wouldn't. This affected userspace which uses inotify, most notably coreutils tail -f, to monitor pipes. If the pipe buffer had been filled by a splice-family function: * tail wouldn't know and thus wouldn't service the pipe, and * all writes to the pipe would block because it's full, thus service was denied. (For the particular case of tail -f this could be worked around with ---disable-inotify.) Generate modify out before access in to let inotify merge the modify out events in thr ipipe case. Fixes: 983652c69199 ("splice: report related fsnotify events") Link: https://lore.kernel.org/linux-fsdevel/jbyihkyk5dtaohdwjyivambb2gffyjs3dodpofafnkkunxq7bu@jngkdxx65pux/t/#u Link: https://bugs.debian.org/1039488 Signed-off-by: Ahelenia Ziemiańska Reviewed-by: Amir Goldstein --- fs/splice.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 3e06611d19ae..b5c7a5ae0e94 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -1154,10 +1154,8 @@ long do_splice(struct file *in, loff_t *off_in, struct file *out, if ((in->f_flags | out->f_flags) & O_NONBLOCK) flags |= SPLICE_F_NONBLOCK; - return splice_pipe_to_pipe(ipipe, opipe, len, flags); - } - - if (ipipe) { + ret = splice_pipe_to_pipe(ipipe, opipe, len, flags); + } else if (ipipe) { if (off_in) return -ESPIPE; if (off_out) { @@ -1182,18 +1180,11 @@ long do_splice(struct file *in, loff_t *off_in, struct file *out, ret = do_splice_from(ipipe, out, &offset, len, flags); file_end_write(out); - if (ret > 0) - fsnotify_modify(out); - if (!off_out) out->f_pos = offset; else *off_out = offset; - - return ret; - } - - if (opipe) { + } else if (opipe) { if (off_out) return -ESPIPE; if (off_in) { @@ -1209,18 +1200,19 @@ long do_splice(struct file *in, loff_t *off_in, struct file *out, ret = splice_file_to_pipe(in, opipe, &offset, len, flags); - if (ret > 0) - fsnotify_access(in); - if (!off_in) in->f_pos = offset; else *off_in = offset; + } else + return -EINVAL; - return ret; + if (ret > 0) { + fsnotify_modify(out); + fsnotify_access(in); } - return -EINVAL; + return ret; } static long __do_splice(struct file *in, loff_t __user *off_in, From patchwork Tue Jun 27 20:50: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: 113605 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8469483vqr; Tue, 27 Jun 2023 14:04:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4/X3ckam/ZQSrHh3JvUliIn4x9qaoX6/9WujEuQJTMiU7Ma0ZWhz7ktYrLCoatItBVYDpC X-Received: by 2002:a05:6a00:2341:b0:680:98c:c58d with SMTP id j1-20020a056a00234100b00680098cc58dmr1213995pfj.2.1687899873578; Tue, 27 Jun 2023 14:04:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687899873; cv=none; d=google.com; s=arc-20160816; b=0Qe5NH2GZJAn4o1khpJ0p3sBgWiNUCpbU0+tR1cB4IXvc2Q/Ay6kZEokO6xikgaz1D TkiWi3H+ziOr6mZVyNpXSOKRDLk6puAriHYuRZDZlVQk7+gi5dWNqi9pkMxlaIeMpsfz H33oTNpbE+tVGexDYUEVk1K0OrfUu5lZscOcZ8kX4t2xCdf3fStzjV3xVru4KMXIsvvb dDYYZbQP7PURjwbdaXg/Iyvku2GRcASnx7SUsvqH4n7SkeI9Vo/aLS9dAPjE+TRLs7ei 5KVsa2Tx2aRrH98SrPCl0kn4/YfpGT84nEcqMgWNGRwx2NOHkxRTMuNBPZ5VMCA+jU2P Bv1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=5c3jqWusw7yTHpo/mTlxqP1X9xA1G+7Wx7TyuyE9aoA=; fh=EwHFucLs4bwDakTQKl/ndDudi5N9htFCanErUntz+qw=; b=TuSE5OZSDboeuy7IGthsxDZtrAk8mFqOuaxJPMuvUInJgtWxSFcOZY13l+/4mQeiaq Om4MQufgTGzMvSlKCDXZJ1NoxgI3BLG1iEKEs4ippd6xpgmEDHPtJNRYRMDrlUbXv248 CfUgXqAXDwYWiJI2EYywvw9Shes6h4oC9SmQ+0hTrsUEf2/s1kcS4aY3Y3hpb+QU8Bcv McMlXhbwLalsuBh0PZ/1S/drZHmkBMwB4eaZ7MUv7Xi4bzCOSMuZjdx2WD/1B00/zqf+ pGS/43iTGqF2E5xhCjet63s/jQqBDLubhTVof45p2ujXMcG/rF9FyJa/EJSKCZSYvaMn wYUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=Idml7t5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r25-20020a6560d9000000b0053f0bfcd4fasi8070949pgv.173.2023.06.27.14.03.56; Tue, 27 Jun 2023 14:04:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=Idml7t5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nabijaczleweli.xyz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231598AbjF0UvM (ORCPT + 99 others); Tue, 27 Jun 2023 16:51:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231584AbjF0UvI (ORCPT ); Tue, 27 Jun 2023 16:51:08 -0400 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A77A0294A; Tue, 27 Jun 2023 13:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1687899060; bh=6Wh1Cs4Lx6l34QcFbXvDoNqOObzq40OnIaHRz3J6+lA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Idml7t5m1KSjmntTg/8gAFAJ/EDz4Lr2BddO4Ua2npmHdP7LXjuQpA20sYyfh4I1i 3wFcnoO1EgqqLnLHQaLGlWiguVFmRIWfmP4QKt3LLt5xAK0P7JR8VT3yknBzAvTl0S fBoilZA9WGbENUtWy7UUhCqj8x46POnvEbjtSkIiKh43PP7312mlfq6SgumuRrcAOq dCMIUgpjwcReQknykV0svSul/aHybkpA0oeQ9YzonP2IY48CAuI7MC012GXzEZ5IOe cX0lMSEdsGKWvePax1AoLM01P1PX5Q6TzrZ/iGQBXxCp4tA1LjkYdp99nabv94ef+E swhyhQknB5SJA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id C7B351A24; Tue, 27 Jun 2023 22:51:00 +0200 (CEST) Date: Tue, 27 Jun 2023 22:50:59 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: Amir Goldstein Cc: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Chung-Chiang Cheng , ltp@lists.linux.it Subject: [PATCH v4 2/3] splice: fsnotify_access(fd)/fsnotify_modify(fd) in vmsplice Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20230517 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,PDS_RDNS_DYNAMIC_FP, RDNS_DYNAMIC,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769891297762185931?= X-GMAIL-MSGID: =?utf-8?q?1769891297762185931?= Same logic applies here: this can fill up the pipe and pollers that rely on getting IN_MODIFY notifications never wake up. Fixes: 983652c69199 ("splice: report related fsnotify events") Link: https://lore.kernel.org/linux-fsdevel/jbyihkyk5dtaohdwjyivambb2gffyjs3dodpofafnkkunxq7bu@jngkdxx65pux/t/#u Link: https://bugs.debian.org/1039488 Signed-off-by: Ahelenia Ziemiańska Reviewed-by: Amir Goldstein --- fs/splice.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/splice.c b/fs/splice.c index b5c7a5ae0e94..d3a7f4d5c078 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -1341,6 +1341,9 @@ static long vmsplice_to_user(struct file *file, struct iov_iter *iter, pipe_unlock(pipe); } + if (ret > 0) + fsnotify_access(file); + return ret; } @@ -1370,8 +1373,10 @@ static long vmsplice_to_pipe(struct file *file, struct iov_iter *iter, if (!ret) ret = iter_to_pipe(iter, pipe, buf_flag); pipe_unlock(pipe); - if (ret > 0) + if (ret > 0) { wakeup_pipe_readers(pipe); + fsnotify_modify(file); + } return ret; } From patchwork Tue Jun 27 20:51: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: 113603 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8464349vqr; Tue, 27 Jun 2023 13:54:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Pnxo76Nn/UqSlIubcfelhdECLRrkjffH0rDOltXKVxpSqaYxy8cMQnFnp7Dc1nJLaUSia X-Received: by 2002:a17:903:11ce:b0:1a6:74f6:fa92 with SMTP id q14-20020a17090311ce00b001a674f6fa92mr9605948plh.19.1687899252749; Tue, 27 Jun 2023 13:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687899252; cv=none; d=google.com; s=arc-20160816; b=pJBK3OWLRDmdmNB3Xc7aMiXo65R9N8cd1oAfWHZ8p5uzcVJYnoOd/iTdspr7rq6jba TiN6snuZjg/yNRyfvGaMTjOm0YHgOH9NCatZMo3SFI3m3h6CyHAjvyipy/YF7P3q4ES9 CvYqwi+vXS2LlVqLBA5L79o3QwRajmSdX/McbCJmieEkX46k0gAbWSb+3LEVcerxYXuc SennSFKCwGbQ+34vlRzgzKox8OFrQC8exLuIczlHSQeEML2/yJN6306hzwVOjWH9NX72 JGJZK9ph3Saz5gt+OJlImIyuU3EZPy1D3johpl0VzXX8UFRwki8aIlM5c+voaTVFMBgE JFqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=nB2HhBFSMAYSyJuXIEO4bSCePNLcfSFj8Iou8Kq0Uvw=; fh=EwHFucLs4bwDakTQKl/ndDudi5N9htFCanErUntz+qw=; b=twk9UP6dMCQSXylN1ViTGLcSCWaw395ehdAe8ZgUb9bgxSPaelfzufwIgKQrS6xeUK nd6h5bP4dNppBeVLeYSJFC63IMk9f4Hz5N6oBdh5RgDSbolF0N2xsCf94+FxGUSOPQ6h xlkFpbRmbsv98bKZYW/t84OHezd4Bve1XnoO+nLYdJx2iHvKji7l8BXlu0bNPeO2JBmv DVcTtmXAydu1t7ee5+1Bh3SWMRFM0HizUB57u3LL4pXiEvEAARmPV+LJmWkfHQV1W+hF HhQTz+ZyTVhn5OmmtfFFMovOco74lyKd1KN/Oknaa3gpyNSUGTGK9tCfZCjO4AfUnIYJ N7fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=lvGWVQNO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i6-20020a170902cf0600b001b024322547si8019586plg.577.2023.06.27.13.54.00; Tue, 27 Jun 2023 13:54:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=lvGWVQNO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nabijaczleweli.xyz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230014AbjF0UvQ (ORCPT + 99 others); Tue, 27 Jun 2023 16:51:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231648AbjF0UvK (ORCPT ); Tue, 27 Jun 2023 16:51:10 -0400 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DAC782D54; Tue, 27 Jun 2023 13:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1687899065; bh=3nrkr9p7FZVJ/pMwJqhBp8M6P5Ay4Bhj6H5jTZYvtg0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lvGWVQNO8/o44Da7YlQ8itfHbwOsJKP7c9R3/eoLHV9YZ+bz8Pwa7lyyeUG4z/Lts k9dtOx9BBVqNTqj0eDSjtO4RFZJfgTyJgAiP1asbOmVyPwQSdy69gmWpXyhaliDRfm ao5/U4tIKuHJb2EzDYxP8N6YJmvkt/bseDXA8JNV0+cLoXfK7IKHHcuc6YfHlOcx1U /t95tPT0rtvQ9IOE3ft4CCMuEAJX+GEewOY4bNkUzkaQvnn+AL5iZpC8Cei/HcQT/8 zLplP+rBntzTPAgvujTofXMYXw7U8/XpaPFRsnkwRcZbX/iqMK3yyH2FiZtHrZP9Gq eJNHIUkf8Q1iQ== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 263C81536; Tue, 27 Jun 2023 22:51:05 +0200 (CEST) Date: Tue, 27 Jun 2023 22:51:04 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: Amir Goldstein Cc: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Chung-Chiang Cheng , ltp@lists.linux.it Subject: [PATCH v4 3/3] splice: fsnotify_access(in), fsnotify_modify(out) on success in tee Message-ID: <1274d6074fdd2ca4e028c8b62e42d0ef2b847703.1687898895.git.nabijaczleweli@nabijaczleweli.xyz> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20230517 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,PDS_RDNS_DYNAMIC_FP, RDNS_DYNAMIC,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769890646565557915?= X-GMAIL-MSGID: =?utf-8?q?1769890646565557915?= Same logic applies here: this can fill up the pipe, and pollers that rely on getting IN_MODIFY notifications never wake up. Fixes: 983652c69199 ("splice: report related fsnotify events") Link: https://lore.kernel.org/linux-fsdevel/jbyihkyk5dtaohdwjyivambb2gffyjs3dodpofafnkkunxq7bu@jngkdxx65pux/t/#u Link: https://bugs.debian.org/1039488 Signed-off-by: Ahelenia Ziemiańska Reviewed-by: Amir Goldstein --- fs/splice.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/splice.c b/fs/splice.c index d3a7f4d5c078..bdbabc2ebfff 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -1810,6 +1810,11 @@ long do_tee(struct file *in, struct file *out, size_t len, unsigned int flags) } } + if (ret > 0) { + fsnotify_access(in); + fsnotify_modify(out); + } + return ret; }