On Wed, Sep 19, 2018 at 4:47 PM Jan Kara <jack@xxxxxxx> 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@xxxxxxxxx> > > 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 */