From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Eric Paris <eparis@redhat.com>,
Marko Rauhamaa <marko.rauhamaa@f-secure.com>,
linux-fsdevel@vger.kernel.org
Subject: [RFC][PATCH 5/6] fanotify: export FAN_ONDIR to user
Date: Mon, 13 Mar 2017 15:20:22 +0200 [thread overview]
Message-ID: <1489411223-12081-6-git-send-email-amir73il@gmail.com> (raw)
In-Reply-To: <1489411223-12081-1-git-send-email-amir73il@gmail.com>
User who requested the flag FAN_EVENT_INFO_PARENT
on fanotify_init() will get the additional information
FAN_ONDIR when event subject is a directory.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
fs/notify/fanotify/fanotify_user.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index adef7b0..bc1ccd0 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -147,17 +147,22 @@ static int fill_event_metadata(struct fsnotify_group *group,
{
int ret = 0;
struct fanotify_event_info *event;
+ __u32 user_mask = FAN_ALL_OUTGOING_EVENTS;
pr_debug("%s: group=%p metadata=%p event=%p\n", __func__,
group, metadata, fsn_event);
+ /* FAN_ONDIR is important for dentry events */
+ if (group->fanotify_data.flags & FAN_EVENT_INFO_PARENT)
+ user_mask |= FAN_ONDIR;
+
*file = NULL;
event = container_of(fsn_event, struct fanotify_event_info, fse);
metadata->event_len = FAN_EVENT_METADATA_LEN;
metadata->metadata_len = FAN_EVENT_METADATA_LEN;
metadata->vers = FANOTIFY_METADATA_VERSION;
metadata->reserved = 0;
- metadata->mask = fsn_event->mask & FAN_ALL_OUTGOING_EVENTS;
+ metadata->mask = fsn_event->mask & user_mask;
metadata->pid = pid_vnr(event->tgid);
if (unlikely(fsn_event->mask & FAN_Q_OVERFLOW))
metadata->fd = FAN_NOFD;
--
2.7.4
next prev parent reply other threads:[~2017-03-13 13:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 13:20 [RFC][PATCH 0/6] fanotify: super block root watch Amir Goldstein
2017-03-13 13:20 ` [RFC][PATCH 1/6] fanotify: add a " Amir Goldstein
2017-03-13 13:20 ` [RFC][PATCH 2/6] fanotify: report events to sb root with fanotify_file_event_info Amir Goldstein
2017-03-13 13:20 ` [RFC][PATCH 3/6] fanotify: pass file handle on sb root watcher events Amir Goldstein
2017-03-13 13:20 ` [RFC][PATCH 4/6] fanotify: report file name to root inode watch with FS_EVENT_ON_CHILD Amir Goldstein
2017-03-13 13:20 ` Amir Goldstein [this message]
2017-03-13 13:20 ` [RFC][PATCH 6/6] fanotify: filter events by root mark mount point Amir Goldstein
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=1489411223-12081-6-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=marko.rauhamaa@f-secure.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).