fanotify: Document mount namespace events
PATCH v3 1/1 fanotify: Document mount namespace events
Used to subscribe for notifications for when mounts are attached/detached from a mount namespace.
---
Changes since v2:
- Added more RVB
- Formatting review fixes
man/man2/fanotify_init.2 | 20 ++++++++++++++++++ man/man2/fanotify_mark.2 | 37 ++++++++++++++++++++++++++++++++- man/man7/fanotify.7 | 45 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-)
man/man2/fanotify_init.2 +20 -0
@@ -331,6 +331,26 @@ that the directory entry is referring to. This is a synonym for .RB ( FAN_REPORT_DFID_NAME | FAN_REPORT_FID | FAN_REPORT_TARGET_FID ). .TP +.BR FAN_REPORT_MNT " (since Linux 6.14)" +.\" commit 0f46d81f2bce970b1c562aa3c944a271bbec2729 +This value allows the receipt of events which contain additional information +about the underlying mount correlated to an event. +An additional record of type +.B FAN_EVENT_INFO_TYPE_MNT +encapsulates the information about the mount and is included alongside the +generic event metadata structure. +The use of +.BR FAN_CLASS_CONTENT , +.BR FAN_CLASS_PRE_CONTENT, +or any of the +.B FAN_REPORT_DFID_NAME_TARGET +flags along with this flag is not permitted +and will result in the error +.BR EINVAL . +See +.BR fanotify (7) +for additional details. +.TP .BR FAN_REPORT_PIDFD " (since Linux 5.15 and 5.10.220)" .\" commit af579beb666aefb17e9a335c12c788c92932baf1 Events for fanotify groups initialized with this flag will contain
man/man2/fanotify_mark.2 +36 -1
@@ -67,7 +67,8 @@ contains all marks for filesystems are removed from the group. Otherwise, all marks for directories and files are removed. No flag other than, and at most one of, the flags -.B FAN_MARK_MOUNT +.BR FAN_MARK_MNTNS , +.BR FAN_MARK_MOUNT , or .B FAN_MARK_FILESYSTEM can be used in conjunction with
@@ -99,6 +100,20 @@ If the filesystem object to be marked is not a directory, the error .B ENOTDIR shall be raised. .TP +.BR FAN_MARK_MNTNS " (since Linux 6.14)" +.\" commit 0f46d81f2bce970b1c562aa3c944a271bbec2729 +Mark the mount namespace specified by +.IR pathname . +If the +.I pathname +is not a path that represents a mount namespace (e.g. +.IR /proc/ pid /ns/mnt ), +the call fails with the error +.BR EINVAL . +An fanotify group that was initialized with flag +.B FAN_REPORT_MNT +is required. +.TP .B FAN_MARK_MOUNT Mark the mount specified by .IR path .
@@ -395,6 +410,26 @@ Create an event when a marked file or directory itself has been moved. An fanotify group that identifies filesystem objects by file handles is required. .TP +.B FAN_MNT_ATTACH +.TQ +.BR FAN_MNT_DETACH " (both since Linux 6.14)" +.\" commit 0f46d81f2bce970b1c562aa3c944a271bbec2729 +Create an event when a mount was attached to or detached from a marked mount namespace, respectively. +An attempt to set this flag on an inode, mount, or filesystem mark +will result in the error +.BR EINVAL . +An fanotify group that was initialized with flag +.B FAN_REPORT_MNT +and the mark flag +.B FAN_MARK_MNTNS +are required. +An additional information record of type +.B FAN_EVENT_INFO_TYPE_MNT +is returned with the event. +See +.BR fanotify (7) +for additional details. +.TP .BR FAN_FS_ERROR " (since Linux 5.16, 5.15.154, and 5.10.220)" .\" commit 9709bd548f11a092d124698118013f66e1740f9b Create an event when a filesystem error
man/man7/fanotify.7 +45 -0
69 lines not on this page · raw message
Signature · 1 line
2.34.1
Alejandro Colomar
maintainerHi Amir,
Quoted 8 lines · Amir Goldstein
Used to subscribe for notifications for when mounts are attached/detached from a mount namespace.
Reviewed-by Jan Kara <[email protected]>Reviewed-by Miklos Szeredi <[email protected]>Reviewed-by Christian Brauner <[email protected]>Signed-off-by Amir Goldstein <[email protected]>---
The patches don't apply, and there are so many that I lost track of in which order I should apply them. Could you please rebase everything you have on top of current master, and resend everything in the order in which I should apply? Sorry for the inconveniences!
Have a lovely day!
Alex
Quoted 183 lines
Changes since v2:
- Added more RVB
- Formatting review fixesman/man2/fanotify_init.2 | 20 ++++++++++++++++++ man/man2/fanotify_mark.2 | 37 ++++++++++++++++++++++++++++++++- man/man7/fanotify.7 | 45 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-)man/man2/fanotify_init.2 +20
-0@@ -331,6 +331,26 @@ that the directory entry is referring to. This is a synonym for .RB ( FAN_REPORT_DFID_NAME | FAN_REPORT_FID | FAN_REPORT_TARGET_FID ). .TP +.BR FAN_REPORT_MNT " (since Linux 6.14)" +.\" commit 0f46d81f2bce970b1c562aa3c944a271bbec2729 +This value allows the receipt of events which contain additional information +about the underlying mount correlated to an event. +An additional record of type +.B FAN_EVENT_INFO_TYPE_MNT +encapsulates the information about the mount and is included alongside the +generic event metadata structure. +The use of +.BR FAN_CLASS_CONTENT , +.BR FAN_CLASS_PRE_CONTENT, +or any of the +.B FAN_REPORT_DFID_NAME_TARGET +flags along with this flag is not permitted +and will result in the error +.BR EINVAL . +See +.BR fanotify (7) +for additional details. +.TP .BR FAN_REPORT_PIDFD " (since Linux 5.15 and 5.10.220)" .\" commit af579beb666aefb17e9a335c12c788c92932baf1 Events for fanotify groups initialized with this flag will containman/man2/fanotify_mark.2 +36
-1@@ -67,7 +67,8 @@ contains all marks for filesystems are removed from the group. Otherwise, all marks for directories and files are removed. No flag other than, and at most one of, the flags -.B FAN_MARK_MOUNT +.BR FAN_MARK_MNTNS , +.BR FAN_MARK_MOUNT , or .B FAN_MARK_FILESYSTEM can be used in conjunction with@@ -99,6 +100,20 @@ If the filesystem object to be marked is not a directory, the error .B ENOTDIR shall be raised. .TP +.BR FAN_MARK_MNTNS " (since Linux 6.14)" +.\" commit 0f46d81f2bce970b1c562aa3c944a271bbec2729 +Mark the mount namespace specified by +.IR pathname . +If the +.I pathname +is not a path that represents a mount namespace (e.g. +.IR /proc/ pid /ns/mnt ), +the call fails with the error +.BR EINVAL . +An fanotify group that was initialized with flag +.B FAN_REPORT_MNT +is required. +.TP .B FAN_MARK_MOUNT Mark the mount specified by .IR path .@@ -395,6 +410,26 @@ Create an event when a marked file or directory itself has been moved. An fanotify group that identifies filesystem objects by file handles is required. .TP +.B FAN_MNT_ATTACH +.TQ +.BR FAN_MNT_DETACH " (both since Linux 6.14)" +.\" commit 0f46d81f2bce970b1c562aa3c944a271bbec2729 +Create an event when a mount was attached to or detached from a marked mount namespace, respectively. +An attempt to set this flag on an inode, mount, or filesystem mark +will result in the error +.BR EINVAL . +An fanotify group that was initialized with flag +.B FAN_REPORT_MNT +and the mark flag +.B FAN_MARK_MNTNS +are required. +An additional information record of type +.B FAN_EVENT_INFO_TYPE_MNT +is returned with the event. +See +.BR fanotify (7) +for additional details. +.TP .BR FAN_FS_ERROR " (since Linux 5.16, 5.15.154, and 5.10.220)" .\" commit 9709bd548f11a092d124698118013f66e1740f9b Create an event when a filesystem errorman/man7/fanotify.7 +45
-0@@ -228,6 +228,23 @@ struct fanotify_event_info_pidfd { .EE .in .P +In cases where an fanotify group is initialized with +.BR FAN_REPORT_MNT , +event listeners should expect to receive the below +information record object alongside the generic +.I fanotify_event_metadata +structure within the read buffer. +This structure is defined as follows: +.P +.in +4n +.EX +struct fanotify_event_info_mnt { + struct fanotify_event_info_header hdr; + __u64 mnt_id; +}; +.EE +.in +.P In case of a .B FAN_FS_ERROR event,@@ -442,6 +459,12 @@ A file or directory that was opened read-only .RB ( O_RDONLY ) was closed. .TP +.BR FAN_MNT_ATTACH +A mount was attached to mount namespace. +.TP +.BR FAN_MNT_DETACH +A mount was detached from mount namespace. +.TP .B FAN_FS_ERROR A filesystem error was detected. .TP@@ -540,6 +563,8 @@ The value of this field can be set to one of the following. .B FAN_EVENT_INFO_TYPE_ERROR .TQ .B FAN_EVENT_INFO_TYPE_RANGE +.TQ +.B FAN_EVENT_INFO_TYPE_MNT .RE .IP The value set for this field@@ -725,6 +750,26 @@ in case of a terminated process, the value will be .BR \-ESRCH . .P The fields of the +.I fanotify_event_info_mnt +structure are as follows: +.TP +.I .hdr +This is a structure of type +.IR fanotify_event_info_header . +The +.I .info_type +field is set to +.BR FAN_EVENT_INFO_TYPE_MNT . +.TP +.I .mnt_id +Identifies the mount associated with the event. +It is a 64-bit unique mount id as the one returned by +.BR statx (2) +with the +.B STATX_MNT_ID_UNIQUE +flag. +.P +The fields of the .I fanotify_event_info_error structure are as follows: .TPSignature · 1 line
2.34.1
Signature · 3 lines
<https://www.alejandro-colomar.es/> <https://www.alejandro-colomar.es:8443/> <http://www.alejandro-colomar.es:8080/>
Quoted 7 lines · Alejandro Colomar
Hi Amir,
Quoted 3 lines · Amir Goldstein
Used to subscribe for notifications for when mounts are attached/detached from a mount namespace.
Quoted 8 lines
Quoted 5 lines
Reviewed-by Jan Kara <[email protected]>Reviewed-by Miklos Szeredi <[email protected]>Reviewed-by Christian Brauner <[email protected]>Signed-off-by Amir Goldstein <[email protected]>---
The patches don't apply, and there are so many that I lost track of in which order I should apply them.
It depends only on the patch that moves the FAN_FS_ERROR entry and that's the only patch left to merge besides this one.
Note that my original FAN_FS_ERROR patch said:
"FAN_EVENT_INFO_TYPE_ERROR was missing from the list of info types"
But you've already added this missing value in an unrelated patch that you merged. Nevermind.
Quoted 3 lines
Could you please rebase everything you
have on top of current master, and resend everything in the order in which I should apply?
Done.
Quoted 2 lines
Sorry for the inconveniences!
No worries.
Thanks,
Amir.