diff options
author | Eric Paris <eparis@redhat.com> | 2009-12-17 21:24:34 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 09:59:00 -0400 |
commit | 4d92604cc90aa18bbbe0f6e23b7a9fdb612836d3 (patch) | |
tree | c04b26fb38a8524fa5e204cb9e40870afa9823f9 /fs/notify/fanotify | |
parent | c9778a98e7440fb73e0d27b8155a688663a0d493 (diff) |
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')
-rw-r--r-- | fs/notify/fanotify/fanotify_user.c | 12 |
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, | |||
514 | 514 | ||
515 | if (flags & ~FAN_ALL_MARK_FLAGS) | 515 | if (flags & ~FAN_ALL_MARK_FLAGS) |
516 | return -EINVAL; | 516 | return -EINVAL; |
517 | switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE)) { | 517 | switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_FLUSH)) { |
518 | case FAN_MARK_ADD: | 518 | case FAN_MARK_ADD: |
519 | case FAN_MARK_REMOVE: | 519 | case FAN_MARK_REMOVE: |
520 | case FAN_MARK_FLUSH: | ||
520 | break; | 521 | break; |
521 | default: | 522 | default: |
522 | return -EINVAL; | 523 | return -EINVAL; |
@@ -545,7 +546,7 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags, | |||
545 | group = filp->private_data; | 546 | group = filp->private_data; |
546 | 547 | ||
547 | /* create/update an inode mark */ | 548 | /* create/update an inode mark */ |
548 | switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE)) { | 549 | switch (flags & (FAN_MARK_ADD | FAN_MARK_REMOVE | FAN_MARK_FLUSH)) { |
549 | case FAN_MARK_ADD: | 550 | case FAN_MARK_ADD: |
550 | if (flags & FAN_MARK_MOUNT) | 551 | if (flags & FAN_MARK_MOUNT) |
551 | ret = fanotify_add_vfsmount_mark(group, mnt, mask, flags); | 552 | ret = fanotify_add_vfsmount_mark(group, mnt, mask, flags); |
@@ -558,6 +559,13 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags, | |||
558 | else | 559 | else |
559 | ret = fanotify_remove_inode_mark(group, inode, mask, flags); | 560 | ret = fanotify_remove_inode_mark(group, inode, mask, flags); |
560 | break; | 561 | break; |
562 | case FAN_MARK_FLUSH: | ||
563 | if (flags & FAN_MARK_MOUNT) | ||
564 | fsnotify_clear_vfsmount_marks_by_group(group); | ||
565 | else | ||
566 | fsnotify_clear_inode_marks_by_group(group); | ||
567 | fsnotify_recalc_group_mask(group); | ||
568 | break; | ||
561 | default: | 569 | default: |
562 | ret = -EINVAL; | 570 | ret = -EINVAL; |
563 | } | 571 | } |