From: Jan Kara <jack@suse.cz>
To: Nilesh Awate <Nilesh.Awate@microsoft.com>
Cc: "jack@suse.cz" <jack@suse.cz>,
linux-fsdevel@vger.kernel.org,
Amir Goldstein <amir73il@gmail.com>
Subject: Re: Fanotify Ignore mask
Date: Mon, 23 Mar 2020 12:57:56 +0100 [thread overview]
Message-ID: <20200323115756.GA28951@quack2.suse.cz> (raw)
In-Reply-To: <TY2P153MB0224EE022C428AA2506AD1879CF30@TY2P153MB0224.APCP153.PROD.OUTLOOK.COM>
Hello Nilesh!
On Sun 22-03-20 17:50:50, Nilesh Awate wrote:
> I'm new to Fanotify. I'm approaching you because I see that you have done great work in Fanotify subsystem.
>
> I've a trivial query. How can we ignore events from a directory, If we have mark "/" as mount.
>
> fd = fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,
> O_RDONLY | O_LARGEFILE);
>
> ret = fanotify_mark(fd, FAN_MARK_ADD | FAN_MARK_MOUNT, FAN_OPEN_PERM | FAN_CLOSE_WRITE,
> AT_FDCWD, "/") ;
>
> Now I don't want events from "/opt" directory is it possible to ignore all events from /opt directory.
>
> I see examples from https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/fanotify/fanotify01.c
> But they all taking about a file. Could you pls help me here.
There's no way how you could 'ignore' events in the whole directory, let
alone even the whole subtree under a directory which you seem to imply.
Ignore mask really only work for avoiding generating events from individual
files. Any more sophisticated filtering needs to happen in userspace after
getting the events from the kernel.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next parent reply other threads:[~2020-03-23 11:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <TY2P153MB0224EE022C428AA2506AD1879CF30@TY2P153MB0224.APCP153.PROD.OUTLOOK.COM>
2020-03-23 11:57 ` Jan Kara [this message]
2020-03-23 13:04 ` Fanotify Ignore mask Amir Goldstein
2020-03-23 13:34 ` [EXTERNAL] " Nilesh Awate
2020-03-23 15:26 ` Amir Goldstein
2020-03-23 15:32 ` Nilesh Awate
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=20200323115756.GA28951@quack2.suse.cz \
--to=jack@suse.cz \
--cc=Nilesh.Awate@microsoft.com \
--cc=amir73il@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
/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