linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Al Viro <viro@zeniv.linux.org.uk>, Eric Paris <eparis@redhat.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC][PATCH 1/2] fsnotify: add event mask FS_EVENT_ON_SB
Date: Tue, 20 Dec 2016 17:20:06 +0200	[thread overview]
Message-ID: <1482247207-4424-2-git-send-email-amir73il@gmail.com> (raw)
In-Reply-To: <1482247207-4424-1-git-send-email-amir73il@gmail.com>

When a watch is added on a super block's root inode with
the FS_EVENT_ON_SB flag, the watched inode is intended
to report events on all inodes on the same super block.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 fs/notify/fsnotify.c             |  2 +-
 include/linux/fsnotify_backend.h | 19 ++++++++++++++++---
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index 3ba0e4a..12d4479 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -297,7 +297,7 @@ static __init int fsnotify_init(void)
 {
 	int ret;
 
-	BUG_ON(hweight32(ALL_FSNOTIFY_EVENTS) != 23);
+	BUG_ON(hweight32(ALL_FSNOTIFY_EVENTS) != 24);
 
 	ret = init_srcu_struct(&fsnotify_mark_srcu);
 	if (ret)
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index b55c64d..b7992da 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -54,6 +54,13 @@
  * dnotify and inotify. */
 #define FS_EVENT_ON_CHILD	0x08000000
 
+/* This root inode cares about things that happen to inodes on same super block.
+ * Can only be set for fanotify.
+ * Overloads IN_ONLYDIR inotify open only flag */
+#define FS_EVENT_ON_SB		0x01000000
+
+#define FS_EVENT_ON_DESCENDANT	(FS_EVENT_ON_CHILD | FS_EVENT_ON_SB)
+
 /* This is a list of all events that may get sent to a parernt based on fs event
  * happening to inodes inside that directory */
 #define FS_EVENTS_POSS_ON_CHILD   (FS_ACCESS | FS_MODIFY | FS_ATTRIB |\
@@ -61,6 +68,11 @@
 				   FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE |\
 				   FS_DELETE | FS_OPEN_PERM | FS_ACCESS_PERM)
 
+/* This is a list of all events that may get sent to the root inode based on fs
+ * event happening to inodes on the same super block */
+#define FS_EVENTS_POSS_ON_SB   (FS_EVENTS_POSS_ON_CHILD |\
+				FS_DELETE_SELF | FS_MOVE_SELF)
+
 #define FS_MOVE			(FS_MOVED_FROM | FS_MOVED_TO)
 
 #define ALL_FSNOTIFY_PERM_EVENTS (FS_OPEN_PERM | FS_ACCESS_PERM)
@@ -70,9 +82,10 @@
 			     FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE | \
 			     FS_DELETE | FS_DELETE_SELF | FS_MOVE_SELF | \
 			     FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \
-			     FS_OPEN_PERM | FS_ACCESS_PERM | FS_EXCL_UNLINK | \
-			     FS_ISDIR | FS_IN_ONESHOT | FS_DN_RENAME | \
-			     FS_DN_MULTISHOT | FS_EVENT_ON_CHILD)
+			     FS_OPEN_PERM | FS_ACCESS_PERM | \
+			     FS_EXCL_UNLINK | FS_ISDIR | FS_IN_ONESHOT | \
+			     FS_DN_RENAME | FS_DN_MULTISHOT | \
+			     FS_EVENT_ON_CHILD | FS_EVENT_ON_SB)
 
 struct fsnotify_group;
 struct fsnotify_event;
-- 
2.7.4

  reply	other threads:[~2016-12-20 15:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20 15:20 [RFC][PATCH 0/2] fsnotify: super block watch Amir Goldstein
2016-12-20 15:20 ` Amir Goldstein [this message]
2016-12-20 15:20 ` [RFC][PATCH 2/2] fsnotify: implement event reporting to super block's root inode Amir Goldstein
2016-12-21 10:15 ` [RFC][PATCH 0/2] fsnotify: super block watch Marko Rauhamaa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1482247207-4424-2-git-send-email-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=eparis@redhat.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [RFC][PATCH 1/2] fsnotify: add event mask FS_EVENT_ON_SB' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).