Skip to content

fanotify: support restartable permission events#1190

Open
vfsci-bot[bot] wants to merge 2 commits intovfs.base.cifrom
pw/1082191/vfs.base.ci
Open

fanotify: support restartable permission events#1190
vfsci-bot[bot] wants to merge 2 commits intovfs.base.cifrom
pw/1082191/vfs.base.ci

Conversation

@vfsci-bot
Copy link
Copy Markdown

@vfsci-bot vfsci-bot bot commented Apr 16, 2026

Series: https://patchwork.kernel.org/project/linux-fsdevel/list/?series=1082191
Submitter: Ibrahim Jirdeh
Version: 3
Patches: 2/2
Message-ID: <20260416194844.3874004-1-ibrahimjirdeh@meta.com>
Base: vfs.base.ci
Lore: https://lore.kernel.org/linux-fsdevel/20260416194844.3874004-1-ibrahimjirdeh@meta.com


Automated by ml2pr

Add fanotify_restart_pending_events() helper that walks the
access_list and reinserts each pending permission event back into
the notification queue for reprocessing. Events are reinserted at
the head of the notification queue without merge or overflow handling.

Suggested-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/linux-fsdevel/sx5g7pmkchjqucfbzi77xh7wx4wua5nteqi5bsa2hfqgxua2a2@v7x6ja3gsirn/
Signed-off-by: Ibrahim Jirdeh <ibrahimjirdeh@meta.com>
This adds support for restarting permission events. The main goal of
the change is to provide better handling for pending events for lazy
file loading use cases which may back fanotify events by a long-lived
daemon. For prior discussion of approaches see [1][2].

In terms of implementation, we add a new control-fd/queue-fd api.
Control fd returned by fanotify_init keeps fanotify group alive and
supports operations like fanotify_mark as well as a new ioctl
FAN_IOC_OPEN_QUEUE_FD to open a queue fd. Queue fd is used
for reading events and writing back responses. Upon release of
queue fd, pending permission events are reinserted back into
notification queue for reprocessing.

Control-fd/queue-fd api is guarded by FAN_RESTARTABLE_EVENTS flag.
In addition FAN_RESTARTABLE_EVENTS can only be used in conjunction
with FAN_CLASS_CONTENT or FAN_CLASS_PRE_CONTENT, and only permission
events can be added to the mark mask if a group is initialized with
FAN_RESTARTABLE_EVENTS.

[1] https://lore.kernel.org/linux-fsdevel/6za2mngeqslmqjg3icoubz37hbbxi6bi44canfsg2aajgkialt@c3ujlrjzkppr
[2] https://lore.kernel.org/linux-fsdevel/20250623192503.2673076-1-ibrahimjirdeh@meta.com

Suggested-by: Amir Goldstein <amir73il@gmail.com>
Link: https://lore.kernel.org/linux-fsdevel/CAOQ4uxhN6ok6BCBGbxeUt9ULq6g=qL6=_2_QGi8MqTHv5ZN7Vg@mail.gmail.com
Signed-off-by: Ibrahim Jirdeh <ibrahimjirdeh@meta.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant