Skip to content

fanotify: Make wait for permission event response interruptible

Jan Kara linux-fsdevel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 13 repliesIn review
  2. v14 patches 10 repliesSuperseded

Changes in v2 from the cover letter

* leave pr_debug() calls alone (Amir)
* simplify permission event state tracking (Amir)
* split some changes into separate patches (Amir)

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6fanotify: Fold dequeue_event() into process_access_response()fs/notify/fanotify/fanotify_user.c+13 -281 reply
2/6fanotify: Move locking inside get_one_event()fs/notify/fanotify/fanotify_user.c+11 -141 reply
3/6fsnotify: Create function to remove event from notification listfs/notify/notification.c include/linux/fsnotify_backend.h+16 -71 reply
4/6fanotify: Simplify cleaning of access_listfs/notify/fanotify/fanotify_user.c+4 -61 reply
5/6fanotify: Track permission event statefs/notify/fanotify/fanotify.c fs/notify/fanotify/fanotify.h fs/notify/fanotify/fanotify_user.c+40 -111 reply
6/6fanotify: Use interruptible wait when waiting for permission eventsfs/notify/fanotify/fanotify.c fs/notify/fanotify/fanotify.h+34 -44 replies

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchAmir Goldstein
1/6R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/6] fanotify: Make wait for permission event response interruptible

Hello,

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) - reported e.g. in [1]. Uninterruptible sleep also makes system hibernation fail if the listener gets frozen before the process generating fanotify permission event (as reported e.g. here [2]).

This patch set modifies fanotify so that it will use interruptible wait when waiting for fanotify permission event response. Patches are based on current Linus' tree for the ease of testing (I plan to rebase them on top of Amir's pending changes later). I have also create LTP test which stresses handling of permission events while sending processes signals to test the new code [3] Review, comments, and testing are welcome.

[1] https://lore.kernel.org/lkml/153474898224.6806.12518115530793064797.stgit@buzz/
[2] https://lore.kernel.org/lkml/[email protected]/
[3] https://lwn.net/ml/linux-fsdevel/[email protected]/

Changes since v1:
* leave pr_debug() calls alone (Amir)
* simplify permission event state tracking (Amir)
* split some changes into separate patches (Amir)

Honza