From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f195.google.com ([209.85.128.195]:35691 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751759AbdCMNVF (ORCPT ); Mon, 13 Mar 2017 09:21:05 -0400 Received: by mail-wr0-f195.google.com with SMTP id u108so20061046wrb.2 for ; Mon, 13 Mar 2017 06:20:31 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: Eric Paris , Marko Rauhamaa , 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 Message-Id: <1489411223-12081-6-git-send-email-amir73il@gmail.com> In-Reply-To: <1489411223-12081-1-git-send-email-amir73il@gmail.com> References: <1489411223-12081-1-git-send-email-amir73il@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 --- 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