From patchwork Sun Dec 2 11:38:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10707965 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 5C31E1057 for ; Sun, 2 Dec 2018 11:38:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 880C72ADB9 for ; Sun, 2 Dec 2018 11:38:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 798E62ADC6; Sun, 2 Dec 2018 11:38:43 +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 0CF582ADC3 for ; Sun, 2 Dec 2018 11:38:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725819AbeLBLio (ORCPT ); Sun, 2 Dec 2018 06:38:44 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38215 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbeLBLin (ORCPT ); Sun, 2 Dec 2018 06:38:43 -0500 Received: by mail-wr1-f65.google.com with SMTP id v13so9307607wrw.5 for ; Sun, 02 Dec 2018 03:38:40 -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=owxUoz1Rm+v6SO8ggemytVkkeSOrGYP+W+4wLlq1iHMTlOihz9qMdAo8fQbiMid48C Hgy2U8FUUNI14MvT6/YZPhd+76+e9jooDM7DmeNqGmvTLK8JnOFeEk7QGExeKzqCAn4A FbKsMwmr16p1rgpOEV6Zvfx1Jx7oklVmQs3IacJHJ/o6Rn26WR7Eh07eNF9QsBBfyVQv 7lU5ghSy1pVa4KgA6hP2qpDlp7qTD4v8ZQo+f6STPd29Ciq9NBokmjJkv6bPj+XpypK5 4NyAELDMNmBWL8GLELR/Yc5vw4+s09XPAGJoxhofpxJHBZcuRj3bSbJqpLY+2oXVmvWD ARvw== 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=YU3LrnUHlbHqN5dOt5ZGb706o1Dp+vIS6WqzqqEFidj2h/MtWBbKYTbpuHI+V26hu4 5m/YyZVLMDV71jxR3N1o2uOgBy1Lohln6/7NC2FhMPxIAaLhFkC9/IThJ1ryOBPTQTF7 i2t+Uz8zJa8H+zykUrw7QADg0SH5GsdsuyD2FUWQY3FLTeQfibOyBxXBAcIERCQeGUP5 dVjEqPG3aV/Ovgpf19hX8Oot9yvdvEihEc+q2Nk8mVV+50o6uj169RAgRqRdSsdO9jW/ QGAjRarPYmf6iI1TPslSlcAj12rwYJujoFpdzDZ0B0HEx2JcYVSn7p+PnGHCHAhmfjn1 XqDQ== X-Gm-Message-State: AA+aEWYQHxeipR3io+UYx3pyfX+eXCEPEeRxVHqzY3XCEFnYO3pi3O9O FhReGU1SHtb3C8diURXl0zI= X-Google-Smtp-Source: AFSGD/VWKaBCFXWOkYSL/C9OyhzbkoHzUJcOs8l2U+0W7euizL5n9nVHN4yF8RFhT4+B5yQ/I1JRaA== X-Received: by 2002:adf:ed46:: with SMTP id u6mr11008412wro.262.1543750719863; Sun, 02 Dec 2018 03:38:39 -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 c3-v6sm3448672wmb.46.2018.12.02.03.38.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Dec 2018 03:38:39 -0800 (PST) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org Subject: [PATCH v4 02/15] fsnotify: send all event types to super block marks Date: Sun, 2 Dec 2018 13:38:13 +0200 Message-Id: <20181202113826.32133-3-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181202113826.32133-1-amir73il@gmail.com> References: <20181202113826.32133-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); } /*