Message ID | cover.1688393619.git.nabijaczleweli@nabijaczleweli.xyz |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp605423vqx; Mon, 3 Jul 2023 08:30:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlHPvSvD5IUOSUFdLEVG5cyRxIuzJg8VWk8URRCje8vdP3G2QpgaCBoym06nptCzM4m1QJWq X-Received: by 2002:a17:902:c246:b0:1b8:5827:8763 with SMTP id 6-20020a170902c24600b001b858278763mr10946719plg.4.1688398254443; Mon, 03 Jul 2023 08:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688398254; cv=none; d=google.com; s=arc-20160816; b=v3RmpaOHCv5sPbNCvw0z868tfIKhJtsDkj8hWCuYo8Z9a4gmnW00LbQuzcfsyX+SfP hcio1MkKSRwtctw/hokK/4/3rDq/2Gi0kzft/maxbaXRbgPPx8Q7hFqmW0T0vUbCzFSa eZhiYLnpLa8DmJom0WZBvwk/zt976+3VolWt1KlCZNl+wlX0LK1wXul30KYtRNj4TsDG UFvOraEdI99hyq+EgSKBJ70McT6ibtzBaU2/FY6dX7ARrQajGQjvVhOI+5dcAwVHWQ83 BR6VIoJFe8UZLyz40RGC3ZEJIpa1kXvNwkXn2IcGDAIlIfCCxFR4bxVsuhMMo1DwH+qT yFqA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w24-20020a1709027b9800b001b81a9aa3d1si12277073pll.223.2023.07.03.08.30.41; Mon, 03 Jul 2023 08:30:54 -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 S231215AbjGCOmP (ORCPT <rfc822;ivan.orlov0322@gmail.com> + 99 others); Mon, 3 Jul 2023 10:42:15 -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 <rfc822;linux-kernel@vger.kernel.org>); 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?= <nabijaczleweli@nabijaczleweli.xyz> To: Christian Brauner <brauner@kernel.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>, Amir Goldstein <amir73il@gmail.com>, Chung-Chiang Cheng <cccheng@synology.com>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 0/3] fanotify accounting for fs/splice.c Message-ID: <cover.1688393619.git.nabijaczleweli@nabijaczleweli.xyz> 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770413888059949217?= X-GMAIL-MSGID: =?utf-8?q?1770413888059949217?= |
Series | fanotify accounting for fs/splice.c | |
Message
Ahelenia Ziemiańska
July 3, 2023, 2:42 p.m. UTC
Previously: https://lore.kernel.org/linux-fsdevel/jbyihkyk5dtaohdwjyivambb2gffyjs3dodpofafnkkunxq7bu@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 ‒ 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ńska (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(-)
Comments
On Mon, 03 Jul 2023 16:42:05 +0200, Ahelenia Ziemiańska wrote: > Previously: https://lore.kernel.org/linux-fsdevel/jbyihkyk5dtaohdwjyivambb2gffyjs3dodpofafnkkunxq7bu@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 > > [...] Fixed the missing single-line-{} after multi-line-{} style problem that Amir mentioned. --- Applied to the vfs.misc branch of the vfs/vfs.git tree. Patches in the vfs.misc branch should appear in linux-next soon. Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it. It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated. Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch. tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.misc [1/3] splice: always fsnotify_access(in), fsnotify_modify(out) on success https://git.kernel.org/vfs/vfs/c/cade9d70ce70 [2/3] splice: fsnotify_access(fd)/fsnotify_modify(fd) in vmsplice https://git.kernel.org/vfs/vfs/c/6aa55b7b85b5 [3/3] splice: fsnotify_access(in), fsnotify_modify(out) on success in tee https://git.kernel.org/vfs/vfs/c/6e7556086b19