From patchwork Tue Jun 27 16:55:44 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: 113518 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8365012vqr; Tue, 27 Jun 2023 10:38:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Vn7IlOG6EmRSt7D1OlP8N+/raDkm9ieVzpKAY79M/C9YzU0jYokfQVW6QSI38dzgmBCSC X-Received: by 2002:a9d:6302:0:b0:6b4:56e9:943 with SMTP id q2-20020a9d6302000000b006b456e90943mr27972124otk.5.1687887535673; Tue, 27 Jun 2023 10:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687887535; cv=none; d=google.com; s=arc-20160816; b=P9nFhfRtemgSm8EdhZYpw6UnSHsIzbgsC0ODEZgivJO8K9F+d9Im1InGVOFu2/eWMk br1chpH4fDR+ae417tNOKrbEICvGPg/6SpjYy4NahTZaWk5GIfkUDn3Zcj9azv8oe6id 0C4v8LY/14C9rCgs6eS20hdmOgISx6vK/ntMkPKNCLvmM5m9l6iudAv/ys6omK9Ui1HP 0Ngx6qgVhTJhLorb2t8d0qjPjmWu5SryRySTVJ3e1YRxsVpbjtJnmggU9ITuYHuTTsTK iRocMNKqEnEgrsu2uSKFtH1Tp0RrOaZwCKDz4qfWDGj8viTSSXgC70jO52JDjI5JQ7ae 7MLg== 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=yQVS+bdagQZU9VaWqQSto6v5ELM9P8R0rowr+dWADks=; fh=dxa6PLKHmBVAinSve5UaytdH17N24IDvSMU4TVOqTkg=; b=cUr5KIHiwl9wsaUF0NVPPNhct5fMBnpBFuSAoy1LN+2sJU2BagAAIe5WLNxIkmL+p4 lyFxQ1O6yW+tPg58LmvTY+Yxc3uhHDuQwVpyamjZCtbYBLSJTlLQgKHr0yDFb4ICcBca X/lTLnRE7OSzTrTC8kA9fUAhqAB2kQUXAfswMicnQnLNr258GRt0l2uvf1dLb7P8xNgV ezI6jFHMKFt5x8yvr5264x1AH95X36odLytsPEfKYzVv5oh1pq687fvrkHECuxrzDdPU R2t//Ko0TsQw94pFwuzdr8j2eUJ99QMYNHybJoM2l1zAboTOH9qNaskA09tNghV9Rxe+ 3bkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=OnmsF1+l; 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 k186-20020a6384c3000000b0054405493a4dsi7555125pgd.199.2023.06.27.10.38.43; Tue, 27 Jun 2023 10:38:55 -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=OnmsF1+l; 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 S229804AbjF0Qzx (ORCPT + 99 others); Tue, 27 Jun 2023 12:55:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbjF0Qzu (ORCPT ); Tue, 27 Jun 2023 12:55:50 -0400 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A705310DA; Tue, 27 Jun 2023 09:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1687884946; bh=Ry0ApNAVb50SUY2QJyeYNcjESfCK9nJXD87gDEkJ+YQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OnmsF1+lOLEYVPB0NGmpzo/9sxh+1my+cdRFWzkAgwdL2Gjc9fQeYY0ktoQQHvOF6 NJHHNKgE8W8LNqitno6cUX0tn5ZTFXrXUgOJzeL9Ce4A8L+O3+yLBBWM5P/lREF/ES rVJoOiR2BPG0egC/DV3Hm81JPAYXyyDJGQFruoreds1yB+49Faj1NvUNUXPMcSo+Yw 7Sixjr35wmqyjMo2VIVcyjB+00hG2KoPT8/IdCvly9m4SFoZjAS5xk/Yb7EQj52fBL o2MvmhtZep+VL7fforI3aTqC3BnD4m8oLcqIXlDC/QSpeJ6sFAseZeQnATxRnfcU2q CDn8aXOjjo8ug== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 011EC1A8C; Tue, 27 Jun 2023 18:55:46 +0200 (CEST) Date: Tue, 27 Jun 2023 18:55:44 +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@vger.kernel.org Subject: [PATCH v3 1/3] splice: always fsnotify_access(in), fsnotify_modify(out) on success Message-ID: <8827a512f0974b9f261887d344c3b1ffde7b21e5.1687884031.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?1769878360734915531?= X-GMAIL-MSGID: =?utf-8?q?1769878360734915531?= 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 --- fs/splice.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 3e06611d19ae..e16f4f032d2f 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,15 @@ 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) { + // splice_write-> already marked out + // as modified via vfs_iter_write() + goto noaccessout; + } else if (opipe) { if (off_out) return -ESPIPE; if (off_in) { @@ -1209,18 +1204,20 @@ 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); +noaccessout: + if (ret > 0) + fsnotify_access(in); - return -EINVAL; + return ret; } static long __do_splice(struct file *in, loff_t __user *off_in, From patchwork Tue Jun 27 16:55: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: 113519 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8366208vqr; Tue, 27 Jun 2023 10:41:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5vOuMRFaxdtiiYmIRjXIUybP5TAARLbOOIFuv2EZsWJ8ksoEGDnwQEwyxE97OPwawyDyS4 X-Received: by 2002:a17:906:ee8b:b0:974:c32c:b485 with SMTP id wt11-20020a170906ee8b00b00974c32cb485mr27684977ejb.45.1687887683885; Tue, 27 Jun 2023 10:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687887683; cv=none; d=google.com; s=arc-20160816; b=PMxGpDg+6OWFYKXxKi8PGDtHcqfqPp+buRuL031Nr4fBiAcXa8X0aKTLLO/gG4oQ7y ZBxfAWBzvOOoCxETUJJDN0FQfL3mFvl6UZFSjqOzdttgpuz0BazLQb48CVKidxGOmIYk ceBb5oHgHKltFLSocGKsleyqve7raa7K9Bhmq/jWiYVH4vaYki/RX4b/d7brm9/6EYZz 1lNfMC6e4AUzr7uaAeH/gAX+rat8cqgwYVkvb2o82t/0OKHftfnnF+YCZWCDCEDisSxT sYf1/aKSlbrVSlGtTMflsGPkLntdUqzNHTeyOUTmNRGxpEt+60GSp+mLdCJs5lFbw0Ye FcvQ== 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=6iSvSW//D5nLKAgleFhxPROnyhTfJTO0xROei99d7xI=; fh=dxa6PLKHmBVAinSve5UaytdH17N24IDvSMU4TVOqTkg=; b=MP3sFG8cvw6+1ETSoq1rILfm9OkpsZltt0UPealWLRrrjAFQRfB9sVBYlG2LuozYMx w3A0noxPdDtPAenU+Kl85pHDN9SU7TOwOVryekNG43wzSB+luY6DbKCApXTFz82EvYfU MnmPbjYuB5FFJTwAmrkev9nBFEHyPYQGqHGu6ZXB1itMLLuKpccQMtGPDlMZHtqWLezf vv9VaY8THZxk0rpqGucCP+rpTliDmB8gs+FcsLMIu8TQVZZs7e+PkeYAWt07Pv7bOvdg XbYqP7NEEAQ6b/y8ziW3kN5kloo6WgdRp9gZZD3uVzQcRLy7ipr0+2gRfxfEgOcKE5mY oBjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=WdMG1sm5; 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 os17-20020a170906af7100b0098e19ebc8f4si3910235ejb.678.2023.06.27.10.40.59; Tue, 27 Jun 2023 10:41:23 -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=WdMG1sm5; 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 S229877AbjF0Qz4 (ORCPT + 99 others); Tue, 27 Jun 2023 12:55:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229762AbjF0Qzx (ORCPT ); Tue, 27 Jun 2023 12:55:53 -0400 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2C6ED10F; Tue, 27 Jun 2023 09:55:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1687884951; bh=zaiiTIQm+Ka+TX+0vYl9PnxvGYZU7w8NqATlroNC6p0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WdMG1sm5NRYxvt8I5gq00DBkYKI3Q4MObBBsJbYbOqARD5a59yVLVqXWjEAMyxcRD Rh8oa93FQxAJBISz7ANoEICJf6GgApt42SYAZPxqLvX7dzSI0+rcZm7OdjR7dl6idW cc0RqjU+ghJV/0ITRG/Xfc8uh1cIQq4G4HDf7d0t1VOtaTkZErVTo5lnP8oJ/lhn8w /q57QcwV8wqexSrRO0lN212HReZZ771YSxo9FQie1eJ2AzDE2uwiugXgQRHVt+Y9KU 8l+5Qln1fSGx4g5ZAeCjHVZRrmSjCjVt5JwaXiqLt/xOtT678NxnQ5lohqkeh/2P5C MeKiMorEgQZGQ== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 6E44B1A8E; Tue, 27 Jun 2023 18:55:51 +0200 (CEST) Date: Tue, 27 Jun 2023 18:55:50 +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@vger.kernel.org Subject: [PATCH v3 2/3] splice: fsnotify_access(fd)/fsnotify_modify(fd) in vmsplice Message-ID: <4206d7388fdbee87053c9655919096225a461423.1687884031.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?1769878515786973932?= X-GMAIL-MSGID: =?utf-8?q?1769878515786973932?= 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 e16f4f032d2f..0eb36e93c030 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 Tue Jun 27 16:55: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: 113515 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8350285vqr; Tue, 27 Jun 2023 10:12:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6/5r8UyOa8S60dNd/sIcDIec8lmcHEwExTR6AgRZbTGFVyVRv45q70l/MP7y6OTvZXB1/5 X-Received: by 2002:aa7:c156:0:b0:51b:ebd7:6442 with SMTP id r22-20020aa7c156000000b0051bebd76442mr11138591edp.17.1687885953571; Tue, 27 Jun 2023 10:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687885953; cv=none; d=google.com; s=arc-20160816; b=vxpUrsDsMkDyj1WIuQUtw2GXZ7R8bSaw2T65cFytSTE2vWk0xPxn+CHS0K+o7nTk0O l8UiVaS2Bp6SvepVMqHYrB7c1bQhD2vOTGnxE57kwOygZug3qPkAfiaqsHMB/gGp/Fkc nAAqDGOPkmwuxgdENQllsWxDGPwAQn3X7IHEWF4MJx/qzEsbsNjzQSDaD18VUYvsnUB4 NBEEbq5awFjXGQerBYHjWKgCBbPDKLZybp2t0yV2THht4UGOh373Rd8R1VfkBWT4yeLo bBGSbaRoE12dp+UADX4bOJPw5V2vQaT2yh2310F4L7RhfFXhQJXK72fE/YySCFqCQlv3 L1bA== 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=OlV/XtRuF/SR3+9UrzZBJt3kkICjxCw53wEdkhKVuMA=; fh=dxa6PLKHmBVAinSve5UaytdH17N24IDvSMU4TVOqTkg=; b=h5HSTRnZj0AJ+uZ0SFWu/LAAfwM65jDCQTh/QSCDsMlLDE8j07Yp9Yj/3Fi8OXS5+e o4gnbBUnVxogtVEUuITMog+7OT/Byn8Ao1iIf07/kgQl8cfvmYgUcXrXA4LgtCtd/FYT mXguO3yA4e5ICBC01rZIApsOC5QY62htcM4ka9gPlt3mdUk0ddaqTg25l6PomytBZrLF lcjWU1+Efz72dAhRzu6WYPJa0SpjyZFdQKGLjySc6Rjp81N8TuhEi1A2Gg2SfFWiAyk7 C92RtkgDEx+WZ9uaTTihaaGrRBd3xlN39xGOQfzJ8wNKn6cPC3oDv6H6yseM1WKhdERA Apxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=CfHLC6O0; 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 j24-20020aa7c418000000b0051db85e2570si34241edq.620.2023.06.27.10.12.07; Tue, 27 Jun 2023 10:12: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=CfHLC6O0; 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 S229971AbjF0Q4G (ORCPT + 99 others); Tue, 27 Jun 2023 12:56:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbjF0Q4C (ORCPT ); Tue, 27 Jun 2023 12:56:02 -0400 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DC27018C; Tue, 27 Jun 2023 09:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1687884956; bh=izqD3jT+ADWBX3rn8DQFe67pMsMvDJNKvE2GgEtMe7s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CfHLC6O0JAaN2qNDtJDzq4Gz/M5XN6XtFNQmfupTu66xUWMV5oPWGWAbtwX3Py7yu 1tOOCa4UaHEOzQptUN1dJeoxRQ8XT5HAOjbFS+/GRntcepqlX0tKIDgk9MsgZwEQsr IUxgNj7FFFPN7CBFpJwWDjL0EATSvlyg93KRax6n+ftB0MzQG4uc54WyWdmbvomfma U9Y8N+63Obc3b1YUQsxzT/EiHxN6b6U2CDDcHITQEc2ZSCV44JNwByM42BuxSDP803 K1QsxMTi2Z4+pbozxfaUr8yKAT/iGz4Ajtih/7wiyniZurlp82qwHxOkuuMtZum3o9 XeJ7DT8gi6REA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 375471A90; Tue, 27 Jun 2023 18:55:56 +0200 (CEST) Date: Tue, 27 Jun 2023 18:55:55 +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@vger.kernel.org Subject: [PATCH v3 3/3] splice: fsnotify_access(in), fsnotify_modify(out) on success in tee Message-ID: <080710f0a1a5c0f124bfa6cc2569b976e0365a91.1687884031.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?1769876701965902510?= X-GMAIL-MSGID: =?utf-8?q?1769876701965902510?= 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 0eb36e93c030..2ecfccbda956 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; }