summaryrefslogtreecommitdiff
path: root/fs/notify/fanotify/fanotify.h
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2019-01-08 15:18:02 +0100
committerJan Kara <jack@suse.cz>2019-02-18 12:41:16 +0100
commitfabf7f29b3e2ce5ed9741bf06f3583cd7e82ed1c (patch)
treee835a20d5acb44c7a58cf5c279a638f5d60e24d5 /fs/notify/fanotify/fanotify.h
parent40873284d7106fc0f0f4d2deae74b38fb18342cc (diff)
fanotify: Use interruptible wait when waiting for permission events
When waiting for response to fanotify permission events, we currently use uninterruptible waits. That makes code simple however it can cause lots of processes to end up in uninterruptible sleep with hard reboot being the only alternative in case fanotify listener process stops responding (e.g. due to a bug in its implementation). Uninterruptible sleep also makes system hibernation fail if the listener gets frozen before the process generating fanotify permission event. Fix these problems by using interruptible sleep for waiting for response to fanotify event. This is slightly tricky though - we have to detect when the event got already reported to userspace as in that case we must not free the event. Instead we push the responsibility for freeing the event to the process that will write response to the event. Reported-by: Orion Poplawski <orion@nwra.com> Reported-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/fanotify/fanotify.h')
-rw-r--r--fs/notify/fanotify/fanotify.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h
index 480f281996d4..68b30504284c 100644
--- a/fs/notify/fanotify/fanotify.h
+++ b/fs/notify/fanotify/fanotify.h
@@ -12,7 +12,8 @@ extern struct kmem_cache *fanotify_perm_event_cachep;
enum {
FAN_EVENT_INIT,
FAN_EVENT_REPORTED,
- FAN_EVENT_ANSWERED
+ FAN_EVENT_ANSWERED,
+ FAN_EVENT_CANCELED,
};
/*