From patchwork Mon Jul 3 14:42:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?0L3QsNCx?= X-Patchwork-Id: 13300199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45D13EB64DC for ; Mon, 3 Jul 2023 14:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231130AbjGCOmO (ORCPT ); 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-Disposition: inline User-Agent: NeoMutt/20230517 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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(-)