From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BA71C43387 for ; Thu, 10 Jan 2019 17:04:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE91C20685 for ; Thu, 10 Jan 2019 17:04:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LuboaFdy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728266AbfAJRE6 (ORCPT ); Thu, 10 Jan 2019 12:04:58 -0500 Received: from mail-wm1-f49.google.com ([209.85.128.49]:40908 "EHLO mail-wm1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728959AbfAJRE5 (ORCPT ); Thu, 10 Jan 2019 12:04:57 -0500 Received: by mail-wm1-f49.google.com with SMTP id f188so12754541wmf.5 for ; Thu, 10 Jan 2019 09:04:56 -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=LuboaFdyRDr50s9BV0rJAeJ2FcoZV+7eeywvTnHu6syt3beTDs8qlc/JGMqQ/Owulf JbY0iwInlvjkdn1cuAhNbNJTuZdGMOALcl+Lq4Px5iEdwIne3Tg1/9F2aUbzi3dEN43i Iut9fxWcCDBoWj8u+i6FrOBMCiYShwANhe158jtEAPzYcdlfhOF2wnUhFT0oN0C0ZPQu +qfFgE/q+qMQuagr0gyC0zAGN+iRQ9hRBUij608k8Hd1Xak3YH/yaDMbIjbQq0EaBrqv Sg/hKFqknTccgQYQwohkHLEkIbfmiNOlG00VxsOJmq5ZNnjKzjroK0l/1FyFHkvWndX2 CtRA== 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=PuZG6svKLh/R60rwtTuhDQwS0pqf6LqE4/mFhHPJv27g/aMntEWoAUnoz3zN9SBnzf 4FqzbUcUJc5BH2nu9K8btf7yo9fKzVl9YguOYyjE7Ny+cYItxg2JfF2TmvDE6rqmZnwW OMC8X1y4OCoJEzfyjtD/A0Y78yOv39ryUd8T8rQ79yaGeYlIeX1uXSrNe9f+olIy4Syt FwQPn2Fjvas0FuDEmT2ZRHV45obvHXzarwgjdhO9SZnJOz/kYbkUf2Onykiah96KKm7k grlvYXKpHWBgjiFP4dnC/16dQPWh9GdkPmC6wD4lHsg5zxkHMlgJSq9NqFfPioH9dnK7 +/ZQ== X-Gm-Message-State: AJcUukfKiAz45cC28fj4fQGv1Bes3vSicTI5YimuoTfaGFmJon/I3FYZ PVX9fsaQp9Dcn19ziWHgWjk= X-Google-Smtp-Source: ALg8bN5aCjAvpMc6Owj2DmZ2Zwsx3YA51I6QyyamTDbHMuEUZD1e+JJJWVi4XLyglzgwYGcAwoD+Lw== X-Received: by 2002:a1c:a401:: with SMTP id n1mr11198690wme.101.1547139895867; Thu, 10 Jan 2019 09:04:55 -0800 (PST) Received: from amir-VirtualBox.ctera.local ([188.120.129.201]) by smtp.gmail.com with ESMTPSA id m4sm5725868wmi.3.2019.01.10.09.04.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 09:04:55 -0800 (PST) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org Subject: [PATCH v5 03/17] fsnotify: send all event types to super block marks Date: Thu, 10 Jan 2019 19:04:30 +0200 Message-Id: <20190110170444.30616-4-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190110170444.30616-1-amir73il@gmail.com> References: <20190110170444.30616-1-amir73il@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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); } /* -- 2.17.1