From patchwork Sun Nov 25 13:43:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10696827 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 21F4717FE for ; Sun, 25 Nov 2018 13:44:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E3972916A for ; Sun, 25 Nov 2018 13:44:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02BB3291C0; Sun, 25 Nov 2018 13:44:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F65D2916A for ; Sun, 25 Nov 2018 13:44:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726242AbeKZAfU (ORCPT ); Sun, 25 Nov 2018 19:35:20 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41037 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726098AbeKZAfT (ORCPT ); Sun, 25 Nov 2018 19:35:19 -0500 Received: by mail-wr1-f65.google.com with SMTP id x10so16232160wrs.8 for ; Sun, 25 Nov 2018 05:44:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+XGKyv15a0ptcvxoKedMcpUarslSIbK+hEOdhJMZe+U=; b=BmE80Lk13V++f0JIWXrMsT5oUt8EJGMVbHl/Ym3OcAnrUvAOwEN718BkBlWnRb7HRp U5NRzfAMSXag6GuuK0kAeJtn2OAaIZtAGNPnslBSink8sz/ftj4K9WsJwW4wdlLz79L3 FD9H7VDa6yaCA28hTgMXxM72KV+FvivgVMel60o3N0/u6MJ6WgYKtK7BrBOuWFfSsfJp f0lwdEvf0N7Nd7mQ43fXNyyvbuRt9JOCP/dhPyHxs5UAEDzl9UJpsXiH3LVeIUkJrH7Z xkzvyYxxVcQ/gK2E12F/GbN7w6xuWk4C167KdWiiJmu/gvZPBYHF6YD4oXuFEuFQFroe YXBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+XGKyv15a0ptcvxoKedMcpUarslSIbK+hEOdhJMZe+U=; b=QmzReo03/WMcCq8u0TQrr/58kRVudxCytsntp/TgXRDNNAz9RAZNW9LCLrHV94Rnb+ 7fLhgAoL8yTaJi+2fSFxurol/P/AtDRaxHGcDJV3Ndmewxu3vRUYZqhKLfHNgfUHV4yu VECgX8m2GezI1sfcJi7M6bagTpc0SaV4wBhyMj/0NdAa24FxnuKww3JKHyNxKFSKgPaB S9J4jIvychv92SbeJ3KTMwR1J87XP1ugIA7Y1+LfYMhyj8JYG7fF8+gqHMOQGYSWU3Md SD1vOLG8yJRwITWJMD6i4QcKO1yt5lz5Xd09zQ3RSDNV/3YVLIjRUffaMw+j4KeGAYB8 528g== X-Gm-Message-State: AA+aEWavWIDjj0F8DXAnli0tJSPIItFHiwSWXwIhWRTcuC87SgDzeHXN JcTBEa9yJgn6J0hjS4S8OOY= X-Google-Smtp-Source: AFSGD/UGtD431bzpw1BeIhhjmSw/IVx9ibGYwj+m6sBQaLHXhG48RLa4qq+RDyGWgv6GCfc5L/nrDw== X-Received: by 2002:adf:a1d2:: with SMTP id v18mr19590947wrv.87.1543153451645; Sun, 25 Nov 2018 05:44:11 -0800 (PST) Received: from localhost.localdomain (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id 125sm17354274wml.35.2018.11.25.05.44.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Nov 2018 05:44:11 -0800 (PST) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org Subject: [PATCH v3 02/13] fsnotify: send all event types to super block marks Date: Sun, 25 Nov 2018 15:43:41 +0200 Message-Id: <20181125134352.21499-3-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181125134352.21499-1-amir73il@gmail.com> References: <20181125134352.21499-1-amir73il@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP So far, existence of super block marks was checked only on events with data type FSNOTIFY_EVENT_PATH. Use the super block of the "to_tell" inode to report the events of all event types to super block marks. This change has no effect on current backends. Soon, this will allow fanotify backend to receive all event types on a super block mark. Signed-off-by: Amir Goldstein --- fs/notify/fsnotify.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index ecf09b6243d9..df06f3da166c 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c @@ -328,16 +328,15 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, const unsigned char *file_name, u32 cookie) { struct fsnotify_iter_info iter_info = {}; - struct super_block *sb = NULL; + struct super_block *sb = to_tell->i_sb; struct mount *mnt = NULL; - __u32 mnt_or_sb_mask = 0; + __u32 mnt_or_sb_mask = sb->s_fsnotify_mask; int ret = 0; __u32 test_mask = (mask & ALL_FSNOTIFY_EVENTS); if (data_is == FSNOTIFY_EVENT_PATH) { mnt = real_mount(((const struct path *)data)->mnt); - sb = mnt->mnt.mnt_sb; - mnt_or_sb_mask = mnt->mnt_fsnotify_mask | sb->s_fsnotify_mask; + mnt_or_sb_mask |= mnt->mnt_fsnotify_mask; } /* An event "on child" is not intended for a mount/sb mark */ if (mask & FS_EVENT_ON_CHILD) @@ -350,8 +349,8 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, * SRCU because we have no references to any objects and do not * need SRCU to keep them "alive". */ - if (!to_tell->i_fsnotify_marks && - (!mnt || (!mnt->mnt_fsnotify_marks && !sb->s_fsnotify_marks))) + if (!to_tell->i_fsnotify_marks && !sb->s_fsnotify_marks && + (!mnt || !mnt->mnt_fsnotify_marks)) return 0; /* * if this is a modify event we may need to clear the ignored masks @@ -366,11 +365,11 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] = fsnotify_first_mark(&to_tell->i_fsnotify_marks); + iter_info.marks[FSNOTIFY_OBJ_TYPE_SB] = + fsnotify_first_mark(&sb->s_fsnotify_marks); if (mnt) { iter_info.marks[FSNOTIFY_OBJ_TYPE_VFSMOUNT] = fsnotify_first_mark(&mnt->mnt_fsnotify_marks); - iter_info.marks[FSNOTIFY_OBJ_TYPE_SB] = - fsnotify_first_mark(&sb->s_fsnotify_marks); } /*