Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26283882rwd; Mon, 3 Jul 2023 07:44:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlEHOpJKJDrPT/hraxUekKmzjCvsCA5a8/e7eql3IafhcXi9qAtY2rar2Gpgugq9I0wrxSu9 X-Received: by 2002:a17:902:b288:b0:1b0:f8:9b2d with SMTP id u8-20020a170902b28800b001b000f89b2dmr11774692plr.29.1688395465157; Mon, 03 Jul 2023 07:44:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688395465; cv=none; d=google.com; s=arc-20160816; b=QbHroQO+x2Bh9yoHEjKvHMNoREmDzvYXcpu0aL99QUwGWdd4Kz15/Uhrvyj3lABiu+ K08QgO1HrS9Jzkh/DLdMc4t9qsnfzdLMe2X1JvJ73J/Co78ACs7bRqZmSn6dDhMPtoQa nhqI9X4CeJ1SruzRtTbFsOwyHO+Vm2RFjF7ykx9GjSeFxFZgCu6DXUxSQ76PSvjUGdJw GqjQWL6hqVKCOeG3+bYfDs3/7iPVqyQa+BTGS3Qoq1hdsJte+A+Sc9FaMvVOKCiSA/3S YL6YOfse+PE561E1xNPU42drnxBoHURa8CI06/RpNVSLUmyIaEhhdt60nb5RiZqwvIf6 MlYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=706/sF4nxxjlUtmMNFdic0TFCqE3UNrp0TzHHV53oCI=; fh=AfCaarrJloRV9X8pgVoQkWOYp+JFhFv1/c5FQOfH+1Q=; b=KGDsS9J8uTPxLJvrP05oy7eqOEgjtBzEdkvc2z50zYfnz5QzX8URDHydWKyCdvhvds SDdyVpWgO8Len7PN+tmeiqiULGirblDVAXUwroH8rFSpNyJiIfEeLdGSiLaClkP1vBtw kPZVu27EvCRVoD487MDo1pKj90SbfuorFsKacdbbY+bh6NhE+E3Ve6wHHS4WhiBhNZZu xIeLupzKY+U9jBeYegKQ02ESfpzq6nEHiu2shoQk1dyG5P4Ml0ErUgQNs5exWqppezxs /Atxppm5XC6koGnwjBvHAei8bFoMwkX6Y4KmwuM3IsJPuLI7N9aOJ4WRF5WSKTcQg1oX GgUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=Dr9I8ddw; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l12-20020a170902d04c00b001b80783427bsi14712182pll.251.2023.07.03.07.44.12; Mon, 03 Jul 2023 07:44:25 -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=Dr9I8ddw; 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 S231211AbjGCOmO (ORCPT + 99 others); Mon, 3 Jul 2023 10:42:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbjGCOmN (ORCPT ); Mon, 3 Jul 2023 10:42:13 -0400 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F34F7B2; Mon, 3 Jul 2023 07:42:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1688395327; bh=cre8VZmV6gYgTF6bv9oEQ8gWcE0Cd+BqTyhkY8/8Gww=; h=Date:From:To:Cc:Subject:From; b=Dr9I8ddw6AGZrBWNXdhCwPsLl7OBiyps+er9THFZTMJfnH8N7VAlV3RTkS+pq1JNj RVbiC1xrGkH/NFNXZNcH6htc23Mgdynw9goSOMtioI2dtq40ocBcTTSDID4MPm1mt4 WBD6COK4jCA5WYIJi3HnPLu5xiEaS2fQcnqjalF/+tRo+k52fHlDFy7p0M2nM900RA wKm1gjh2G88hdPq44Gp1fcsfWvDpTVFCOK18ms7+DR4k/CaWuVr6pqTsA+gwL5jRQv tF3sgn1V1kOVyg56IMY4cZGSHmzOAEOwQ0+QTqp1rrZHSP/IAdEQ99RESkG4Ti/1HO 3ryDp42PYV7zQ== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 04C8A1B6A; Mon, 3 Jul 2023 16:42:07 +0200 (CEST) Date: Mon, 3 Jul 2023 16:42:05 +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 0/3] fanotify accounting for fs/splice.c Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="h7vuydtxhwlulk7a" Content-Disposition: inline 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 --h7vuydtxhwlulk7a Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Previously: https://lore.kernel.org/linux-fsdevel/jbyihkyk5dtaohdwjyivambb2= gffyjs3dodpofafnkkunxq7bu@jngkdxx65pux/t/#u In short: * most read/write APIs generate ACCESS/MODIFY for the read/written file(s) * except the [vm]splice/tee family (actually, since 6.4, splice itself /does/ generate events but only for the non-pipes being spliced from/to; this commit is Fixes:ed) * userspace that registers (i|fa)notify on pipes usually relies on it actually working (coreutils tail -f is the primo example) * it's sub-optimal when someone with a magic syscall can fill up a pipe simultaneously ensuring it will never get serviced Thus: actually generate ACCESS/MODIFY for all the [vm]spliced/teed-from/to files. LTP tests are staged in https://git.sr.ht/~nabijaczleweli/ltp/commit/v4 ("inotify13: new test for fs/splice.c functions vs pipes vs inotify"), validating that one A and/or one M event per [vm]splice(), tee(), and sendfile() is generated =E2=80=92 without this patchset, this only holds for sendfile(). Amir has identified a potential performance impact caused by correctly generating events, and has prepared patches at https://github.com/amir73il/linux/commits/fsnotify_pipe that optimise the most common cases more aggressively. Please review, and please consider taking these through the vfs tree for 6.6. Thanks, Ahelenia Ziemia=C5=84ska (3): splice: always fsnotify_access(in), fsnotify_modify(out) on success splice: fsnotify_access(fd)/fsnotify_modify(fd) in vmsplice splice: fsnotify_access(in), fsnotify_modify(out) on success in tee fs/splice.c | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) --=20 2.39.2 --h7vuydtxhwlulk7a Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEfWlHToQCjFzAxEFjvP0LAY0mWPEFAmSi3j0ACgkQvP0LAY0m WPEtEQ/9F6xggxB4EolNBUV1fvUunoQyDjqsg//EpbRE/TxQUdUnVrYtCuNxM0gE jphR/F8R2h2iJmf3p8d/Omjshnggp45+fnKFH3xoY3dNctPNUujmWEDFPtMPPrc6 ZI63MAg/nDUORSlMBu4mCmBWhwkjXR+NViseN49vZQEkkxZiJP8RVBCQUNevze/Q ZSXE3wjXzMFRU1Q+qa64Zwz5cQnhQxkUHMt/8ILLbrlDCC8WO1wj8ZfwIIT5HGza kC8AgMIhm/LpjBg/RP8xgqySAawRbJuPXd/jRdCI4gAgERZSCPoHtWMpAj/kP4vN YzbsWJjH5qsvnEmDl6f6UWTMc+MygDbNF3RawoA2qM0WADISzKyq6fr2f+M+Q47I JdP1DhzXg4BtUNHadJvKEkWhw0+S2WEF0pPnN7JAoX3IE5K7Wg9cC4U4Og4IiA0i xp5XaECxIKxAOSVUf/HOXnKbJjO+gGIL9CuXAAx0cYp4xEi/H+HMxZU1KdJ9a0Mh FJxox+P1Ghsfu8/fj9kQjGvNSikfufzxBGHxVo/1pF6cW0DMtXLrQDeCnfXhXKGX twKYgURcYzDkbJ0gjRJbwbenGhZL56IwRG0rEbIzyMg49qlhT8CARwabGDj4RiWW OLMcKJJgLxx78aRQ+STrY7Yu584PZgJpPPKAy4dvRhB3DgBg8lI= =g2al -----END PGP SIGNATURE----- --h7vuydtxhwlulk7a--