summaryrefslogtreecommitdiffstats
path: root/fs/notify/fanotify/fanotify_user.c
diff options
context:
space:
mode:
authorEric Paris2009-12-18 03:24:34 +0100
committerEric Paris2010-07-28 15:59:00 +0200
commit4d92604cc90aa18bbbe0f6e23b7a9fdb612836d3 (patch)
treec04b26fb38a8524fa5e204cb9e40870afa9823f9 /fs/notify/fanotify/fanotify_user.c
parentfanotify: allow ignored_masks to survive modify (diff)
downloadkernel-qcow2-linux-4d92604cc90aa18bbbe0f6e23b7a9fdb612836d3.tar.gz
kernel-qcow2-linux-4d92604cc90aa18bbbe0f6e23b7a9fdb612836d3.tar.xz
kernel-qcow2-linux-4d92604cc90aa18bbbe0f6e23b7a9fdb612836d3.zip
fanotify: clear all fanotify marks
fanotify listeners may want to clear all marks. They may want to do this to destroy all of their inode marks which have nothing but ignores. Realistically this is useful for av vendors who update policy and want to clear all of their cached allows. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify/fanotify/fanotify_user.c')
-rw-r--r--fs/notify/fanotify/fanotify_user.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 3e275f17e7b7..9fe760baf69f 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -514,9 +514,10 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
if (flags & ~FAN_ALL_MARK_FLAGS)
return -EINVAL;
- switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE)) {
+ switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_FLUSH)) {
case FAN_MARK_ADD:
case FAN_MARK_REMOVE:
+ case FAN_MARK_FLUSH:
break;
default:
return -EINVAL;
@@ -545,7 +546,7 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
group = filp->private_data;
/* create/update an inode mark */
- switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE)) {
+ switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_FLUSH)) {
case FAN_MARK_ADD:
if (flags & FAN_MARK_MOUNT)
ret = fanotify_add_vfsmount_mark(group, mnt, mask, flags);
@@ -558,6 +559,13 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags,
else
ret = fanotify_remove_inode_mark(group, inode, mask, flags);
break;
+ case FAN_MARK_FLUSH:
+ if (flags & FAN_MARK_MOUNT)
+ fsnotify_clear_vfsmount_marks_by_group(group);
+ else
+ fsnotify_clear_inode_marks_by_group(group);
+ fsnotify_recalc_group_mask(group);
+ break;
default:
ret = -EINVAL;
}