diff options
author | Naohiro Aota <naota@elisp.net> | 2012-05-29 11:02:24 -0700 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-05-30 21:04:53 -0400 |
commit | a4f9a9a635e4d54ac93df4b861ed8792e17bd4a2 (patch) | |
tree | 40a7145d4d24db3dd26848a8905f710306cbfaa1 /include/linux/bch.h | |
parent | 799243a389bde0de10fa21ca1ca453d2fe538b85 (diff) | |
download | linux-stable-a4f9a9a635e4d54ac93df4b861ed8792e17bd4a2.tar.gz linux-stable-a4f9a9a635e4d54ac93df4b861ed8792e17bd4a2.tar.bz2 linux-stable-a4f9a9a635e4d54ac93df4b861ed8792e17bd4a2.zip |
fsnotify: handle subfiles' perm events
Recently I'm working on fanotify and found the following strange
behaviors.
I wrote a program to set fanotify_mark on "/tmp/block" and FAN_DENY
all events notified.
fanotify_mask = FAN_ALL_EVENTS | FAN_ALL_PERM_EVENTS | FAN_EVENT_ON_CHILD:
$ cd /tmp/block; cat foo
cat: foo: Operation not permitted
Operation on the file is blocked as expected.
But,
fanotify_mask = FAN_ALL_PERM_EVENTS | FAN_EVENT_ON_CHILD:
$ cd /tmp/block; cat foo
aaa
It's not blocked anymore. This is confusing behavior. Also reading
commit "fsnotify: call fsnotify_parent in perm events", it seems like
fsnotify should handle subfiles' perm events as well as the other notify
events.
With this patch, regardless of FAN_ALL_EVENTS set or not:
$ cd /tmp/block; cat foo
cat: foo: Operation not permitted
Operation on the file is now blocked properly.
FS_OPEN_PERM and FS_ACCESS_PERM are not listed on FS_EVENTS_POSS_ON_CHILD.
Due to fsnotify_inode_watches_children() check, if you only specify only
these events as fsnotify_mask, you don't get subfiles' perm events
notified.
This patch add the events to FS_EVENTS_POSS_ON_CHILD to get them notified
even if only these events are specified to fsnotify_mask.
Signed-off-by: Naohiro Aota <naota@elisp.net>
Cc: Eric Paris <eparis@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/bch.h')
0 files changed, 0 insertions, 0 deletions