From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: nixiaoming@huawei.com, linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH] fanotify: store fanotify_init() flags in group's fanotify_data
Date: Wed, 19 Sep 2018 20:36:44 +0300 [thread overview]
Message-ID: <CAOQ4uxgi1riuUVTDQv8Pu_b2GXHtjoaz4zK3MonpwzRqszVhyw@mail.gmail.com> (raw)
In-Reply-To: <20180919134703.GA3970@quack2.suse.cz>
On Wed, Sep 19, 2018 at 4:47 PM Jan Kara <jack@suse.cz> wrote:
>
> On Tue 18-09-18 18:44:34, Amir Goldstein wrote:
> > This averts the need to re-generate flags in fanotify_show_fdinfo()
> > and sets the scene for addition of more upcoming flags without growing
> > new members to the fanotify_data struct.
> >
> > Signed-off-by: Amir Goldstein <amir73il@gmail.com>
>
> Thanks. I've taken this patch to my tree for the next merge window.
>
Actually, could you please grab the later version of this patch, which
is a bit nicer, from:
https://github.com/amir73il/linux/commits/fanotify_unpriv
I was going to post v2, but you beat me to it.
Below is v1..v2 diff.
Thanks!
Amir.
----
diff --git a/fs/notify/fanotify/fanotify_user.c
b/fs/notify/fanotify/fanotify_user.c
index 0562738a4c51..afa89eafe79f 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -191,8 +191,7 @@ static int process_access_response(struct
fsnotify_group *group,
if (fd < 0)
return -EINVAL;
- if ((response & FAN_AUDIT) &&
- !(group->fanotify_data.flags & FAN_ENABLE_AUDIT))
+ if ((response & FAN_AUDIT) && !FAN_GROUP_FLAG(group, FAN_ENABLE_AUDIT))
return -EINVAL;
event = dequeue_event(group, fd);
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
index 096c96f4f16a..9c5ea3bdfaa0 100644
--- a/include/linux/fanotify.h
+++ b/include/linux/fanotify.h
@@ -6,4 +6,8 @@
/* not valid from userspace, only kernel internal */
#define FAN_MARK_ONDIR 0x00000100
+
+#define FAN_GROUP_FLAG(group, flag) \
+ ((group)->fanotify_data.flags & (flag))
+
#endif /* _LINUX_FANOTIFY_H */
prev parent reply other threads:[~2018-09-19 23:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-18 15:44 [PATCH] fanotify: store fanotify_init() flags in group's fanotify_data Amir Goldstein
2018-09-19 13:47 ` Jan Kara
2018-09-19 17:36 ` Amir Goldstein [this message]
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=CAOQ4uxgi1riuUVTDQv8Pu_b2GXHtjoaz4zK3MonpwzRqszVhyw@mail.gmail.com \
--to=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=nixiaoming@huawei.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).