From patchwork Mon Jul 3 14:42:13 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: 115409 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp581887vqx; Mon, 3 Jul 2023 07:57:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlEWabvhdoy78H3UzTuW8K6V0y0l71d6qtJvh6a+4KqhxlcxQnfNOTV2Hx357G9Os4DbcHlP X-Received: by 2002:a17:902:7c82:b0:1b8:9fc4:2733 with SMTP id y2-20020a1709027c8200b001b89fc42733mr1086374pll.3.1688396261655; Mon, 03 Jul 2023 07:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688396261; cv=none; d=google.com; s=arc-20160816; b=PBOSYWrTmHbufP1ueR+4AIfRjDSvrjABDJMWt+9+h+3dYeBYWhuVsEmqdeFymZLkvs 7HozIjFAyRaEjQhrkro48aHg73OmwjsbiRmV6vRHY2eVHsf1b8to1Vxfj5RT6AVsDumY Kb6DA953GGFOJgaD+jlpv7DEQoS44O5o9cVcWkkZgY8GA6WLF9q6p4UvN1jfvdT7HNTP 7YHY0CWZZaq5z8SpCVNo9OAmIS2rzA2YjYyYOo+3JdPPrqvTxv03Qc4KAq+M42Cqrkiz MGfPNEdsiXVLBobtxYGh6q/W4LBz/UASTaBTTobUyquzh0vJgVSznsaPhaCSCvmv/IeC +NNw== 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=+9esspNFZECgfIJtAXuayWzH+pCWd0OfJzUtm4d/Hk8=; fh=AfCaarrJloRV9X8pgVoQkWOYp+JFhFv1/c5FQOfH+1Q=; b=B5zO+RqFlMXZYRohne4qnzu5TppIZqGvl4lcD4W87o3B9liJoIF2RjEpwTRxP2rdY5 Dvl1saykKVb6V9wBdxniYKVcIb8BhwTZu9DYYoCjMe4RUl7hDvD2Cfc/CGpY2fkz/l5Q zWnfU5oj7kdHO/h6OFRlIr1lHSYph8Yd7h/elhPpeQjotfPLwoG7M/krdkjF0pktmitO 7SZJ+X/NKo7bFs7wa0G1fe5HuQcsd3m2gVNRFG8sCCz2jOOaas+BpsyIFc9vQEi6CpTR lr+D5eAhiAWbTLBPtLVIkPJNUXt9WYwesfKt+hoJfI9iujCqHXfqnhimc6yOAdkaUT/w B6LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=hKE4LH1q; 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 k13-20020a170902ce0d00b001b025aba9f2si19574394plg.22.2023.07.03.07.57.27; Mon, 03 Jul 2023 07:57:41 -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=hKE4LH1q; 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 S231232AbjGCOmS (ORCPT + 99 others); Mon, 3 Jul 2023 10:42:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231223AbjGCOmQ (ORCPT ); Mon, 3 Jul 2023 10:42:16 -0400 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 12002B2; Mon, 3 Jul 2023 07:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1688395334; bh=xUQlRJiv0BrDJu2N4vefK4PLI4lrSt6Z70TDgeQpcYs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hKE4LH1qBJLiXXH9rih/kbNbGViPFRh7mp4kfHOm8PL48Or5SW9QTOO/HZOz0Wiqo /dV6D/T26s14gdarunqZSVTjn1AigsmFkD3jSblOg8ZLckdb7zPN5HhkOwD64aywR9 ffHZwQJBm40JW38O99WfivmMcRi+Lltc3Zwqkpami0Cxc0GnO/is19Q8qapVqPr+cl 6TLGGcvYMbWdN+vqAQqGj56hDfHCqi9BT58EARtAIm6QgOCO9QL4iQec6MTF/ZfH8K erTR/VfIhdHCiB288dTe2BY1fHtPUtWtc5MYFrypJxZ8//WHk9DvbWtufi03usHRph pgTITT+bp/m2g== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 571C71DBE; Mon, 3 Jul 2023 16:42:14 +0200 (CEST) Date: Mon, 3 Jul 2023 16:42:13 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: Christian Brauner Cc: Alexander Viro , Jan Kara , Amir Goldstein , Chung-Chiang Cheng , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/3] splice: always fsnotify_access(in), fsnotify_modify(out) on success Message-ID: <604ec704d933e0e0121d9e107ce914512e045fad.1688393619.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 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?1770411798555978180?= X-GMAIL-MSGID: =?utf-8?q?1770411798555978180?= 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.) 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 Acked-by: Jan Kara --- fs/splice.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 3e06611d19ae..6ae6da52eba9 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,24 @@ 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) { + /* + * Generate modify out before access in: + * do_splice_from() may've already sent modify out, + * and this ensures the events get merged. + */ + fsnotify_modify(out); + fsnotify_access(in); } - return -EINVAL; + return ret; } static long __do_splice(struct file *in, loff_t __user *off_in, From patchwork Mon Jul 3 14:42:17 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: 115410 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp583042vqx; Mon, 3 Jul 2023 07:59:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlGCRmEou3lOQrH0/sbE1e8/P62iu2eZpFX9P6MmjsU9mjzn+k/R/+LRcAR1Kv8CAwVIpsAh X-Received: by 2002:a05:6e02:f41:b0:346:1919:7cb1 with SMTP id y1-20020a056e020f4100b0034619197cb1mr967416ilj.2.1688396388786; Mon, 03 Jul 2023 07:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688396388; cv=none; d=google.com; s=arc-20160816; b=mszuNqBLS1cDULuhcXo/vmNGA/xyeNHtgM123kiBNRwg5gSLEXcznWekvj2zj7DrP1 kA/NrCeC2hf7nzohY90TGVAkqhzSGxsYHWGoIGmmRYm7SjjfLD/Cgn7UeIIW4+4aR8UN I3D4mvp4xVd5uJr7SH48xmINBZf2vh0yvU0RASBBayst2zfYaHEq8bdSItk9av25LNdR lRIySq++TU6V4UjURuLWBOOYwMDhxS/XIKFVgnNpqKVXTNE4tZfv6RQ393A6G2DeWzaw ARRkwSLgjdrtHU6223VeM21U/mMcFAVXNqke8dgUWSpeDTGLDIm5gMbnXz7b2R/hOEWf 9Ziw== 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=giTQJ2zpd3lLBmA47HNrew2ito+XTx/TmIVybCLGoeA=; fh=AfCaarrJloRV9X8pgVoQkWOYp+JFhFv1/c5FQOfH+1Q=; b=tRMmHlvbkRqBQCUKZAYO+/2b5T8k8BZ55YgRc4aM6+3qyAzCkPyrBx1WWAyGHvCeoJ ksG9pP9SbIN4zx3Mb6lFk6zhAfd/Uknwwx1a2/JpUBtzEdUDwDs6zJ/iziqDH5DTJ3aB iTpIq2/8xdkXePjUrxGj0KGdLIsHWzM1nJ7Qx6OHs9coQloW6Y7lkoG7h/Jm7FSZoAZW Ka8smYfFADZ7EG4eaYDG6DGOeUzeBlf3A2WQkucDBOiOcR/EOmoSb4zz7ka31neicPgH pbJwUuouMOK159qDwmcN1IXqH5NNF1HOe3+q7+kgFW0Rr6PrgNVYu/iU0YBVxTp7JnEE Co2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=AhrIA4bp; 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 18-20020a630e52000000b0055b553157a9si7933909pgo.827.2023.07.03.07.59.35; Mon, 03 Jul 2023 07:59:48 -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=AhrIA4bp; 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 S231274AbjGCOmW (ORCPT + 99 others); Mon, 3 Jul 2023 10:42:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbjGCOmU (ORCPT ); Mon, 3 Jul 2023 10:42:20 -0400 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 428C3E5C; Mon, 3 Jul 2023 07:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1688395338; bh=bxFjauUq2WL32jHSPjtbjDPG477Jdv0YrEDq/u80aBE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AhrIA4bpNXctnbjB9zL/sj1rGqhNvu6fT18CYncnYQWpQSIoov7xveEfjOSjqjLPy zFtA91S2is2jbaHqb6RgRM3K+YTrqhLPanrW513653hGfBScv8jheHZe9kn0okLZZJ XKA+JI+Yg0gIQrMPbxwRdGJ9k8THmYYI2v3APzNvzS8NqREcJzHyi8SqAHc1REhDAb TdXAgU+ldh/kaK3eaOOH/XDcfCLjqBQvtKHCWbxiQdr3wWsbCEEtQ7uT4FVP57VCL3 kYYXfuN2yUQWehsiZ/iLwv1fgzmh7N4qgxt2MBp0PUydMkBLfKNDQ2tHekvoqg0yO5 EZklTMJRFR6dg== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 8FBCE1B6C; Mon, 3 Jul 2023 16:42:18 +0200 (CEST) Date: Mon, 3 Jul 2023 16:42:17 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: Christian Brauner Cc: Alexander Viro , Jan Kara , Amir Goldstein , Chung-Chiang Cheng , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 2/3] splice: fsnotify_access(fd)/fsnotify_modify(fd) in vmsplice Message-ID: <8d9ad5acb9c5c1dd2376a2ff5da6ac3183115389.1688393619.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 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?1770411931813647162?= X-GMAIL-MSGID: =?utf-8?q?1770411931813647162?= 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 Acked-by: Jan Kara --- fs/splice.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/splice.c b/fs/splice.c index 6ae6da52eba9..5deb12d743b1 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -1346,6 +1346,9 @@ static long vmsplice_to_user(struct file *file, struct iov_iter *iter, pipe_unlock(pipe); } + if (ret > 0) + fsnotify_access(file); + return ret; } @@ -1375,8 +1378,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 Mon Jul 3 14:42:21 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: 115401 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp575667vqx; Mon, 3 Jul 2023 07:45:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6iwM+lw1KYcbnyRFnn/yw7OdQg+BiYtZtd8yF5OPyC/LGc9670kdY/uUnki2XHv82yBtbm X-Received: by 2002:a05:6a21:9989:b0:12c:bbd3:a0dd with SMTP id ve9-20020a056a21998900b0012cbbd3a0ddmr15448605pzb.0.1688395553713; Mon, 03 Jul 2023 07:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688395553; cv=none; d=google.com; s=arc-20160816; b=XSYLl1O4MtvhIbIsPb48kJKmFFZannZ4RJrhFsgBSomhz0uz+SvPu63VTYtj2VQxbY Q3DTEPpmNmv0ei0haLgMqftfmMfJ5VMmI5sQtrF+/B3EuoTXe9A7y3kV6jTcTNYv0qhv SAjsyF9jPIkIFpgbPLERpG/KDEd4SrDe4V2G3ITwHg87CiNi4oCqhMKONgoxJkrppGHF CYdIo8FoyjQ/nf/BaavRJ0GTDBLQnE6EQu5WCU0cOJTznC+vQ59CEd9WLOXtZHJsBBUJ hnGZU6+7P6zGaJnJwCU3cxvGkOiC7cIrkl9cCXKyd4+ORi2a2Ht3GcBaUicyIVRFH3YZ gRBg== 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=So6jXT0WYt/MPFDr7iZzJBW84Dz1OXnGoKO73pWKQ2Y=; fh=AfCaarrJloRV9X8pgVoQkWOYp+JFhFv1/c5FQOfH+1Q=; b=PURehPUOwpInNSms7FvVUa+hqStgs/z/H6n3lilFYn7SbjNBGuRr0pAmqS3F8eTwRL ty3S4BqoiX3Tncd2JYrfbqbhtJiyor10NtH6cFIailfb0Zb1f7pvqj5TVl9m6WWihEqY nDQXYX5UeXl4hd+Qv6LIvRv1NBpAf7BXo8OuvJ2FZUNOIArwsgTgjVE8yW3gAdzkS1Hl 81lDlQbWDr6iWBibfZbqLKL/4ZsCAg3xhZlrR7aXGtKFiQpOawvuERQRNP9ih+UV3ZaY qa112Xpsiz5lCaMk+cST7gWm2jBVkZxv+PsSXveSMJAPuKqnAKtoQ+iLPenRlUELxxiT ZSfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=EsXuPnSi; 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 j16-20020a170902da9000b001b891de7583si3365795plx.348.2023.07.03.07.45.40; Mon, 03 Jul 2023 07:45:53 -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=EsXuPnSi; 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 S231304AbjGCOm3 (ORCPT + 99 others); Mon, 3 Jul 2023 10:42:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231290AbjGCOm1 (ORCPT ); Mon, 3 Jul 2023 10:42:27 -0400 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 806B2E74; Mon, 3 Jul 2023 07:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1688395342; bh=SowbDY6YnsriPuN0djgR0SpF4itfDBztRXtp8moML7o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EsXuPnSi0xOmIDA9aB+N2jhQz9p0AOzj61HDIQTIJdzsnRWnGbDF/huwP1B2Kx+s4 GKbOd+IEDrPuqA8IYlgDBOn6HOsDRcDqUnEcUykq7eexZHfYx4Z3D/N8VYaI//nkFq WJkt4AYUkUzX5FoP6FZzjhpdok8hVpqoRCs4WGx2pbfxIKqawO2xUiBirSXWlAmDpE P8FV50NHcwz5rhWzafQCFhpJ2R+IRTIKCBssG8XeIt/RX5FLzqNjXl7fEXeVDbeqZB +llvKsXyqOJZ9yQPPq7UR0PsOfrof+FV3TOpe1D5CNEgiM3y7YUE3X9IMLGbTYa4l6 iS2kXT2bbIGnA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 9D49F1DC4; Mon, 3 Jul 2023 16:42:22 +0200 (CEST) Date: Mon, 3 Jul 2023 16:42:21 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: Christian Brauner Cc: Alexander Viro , Jan Kara , Amir Goldstein , Chung-Chiang Cheng , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 3/3] splice: fsnotify_access(in), fsnotify_modify(out) on success in tee Message-ID: <10d76dd8c85017ae3cd047c9b9a32e26daefdaa2.1688393619.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 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?1770411056199349706?= X-GMAIL-MSGID: =?utf-8?q?1770411056199349706?= 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 Acked-by: Jan Kara --- fs/splice.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/splice.c b/fs/splice.c index 5deb12d743b1..c49909dbf3c5 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -1815,6 +1815,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; }