On Tue, Feb 26, 2019 at 5:44 PM Michael Kerrisk (man-pages) <mtk.manpages@xxxxxxxxx> wrote: > > On 2/4/19 9:53 AM, Amir Goldstein wrote: > > On Sat, Nov 17, 2018 at 6:32 PM Amir Goldstein <amir73il@xxxxxxxxx> wrote: > >> > >> Hi Michael, > >> > >> Here are the updates w.r.t new fanotify API FAN_MARK_FILESYSTEM > >> and FAN_REPORT_TID that were merged for kernel v4.20-rc1. > >> > > > > Hi Michael, > > > > I forgot to follow up on those changes. > > Haven't been following man page release process. > > Are man page releases correlated with kernel point releases? > > Hello Amir, > > Send the patches any time. CC me and linux-man@xxxxxxxxxxxxxxx > please. It's been a long time since I did a release. But I > will do one "soon". > Hi Michael, I had already sent the patched back in Nov to the list. Attached here again. Thanks, Amir.
From 8e70bc5b543a946edf6bb3c6fcf312823f3f0731 Mon Sep 17 00:00:00 2001 From: Amir Goldstein <amir73il@xxxxxxxxx> Date: Sun, 19 Aug 2018 18:12:12 +0300 Subject: [PATCH 1/2] fanotify: Document FAN_MARK_FILESYSTEM Monitor fanotify events on the entire filesystem. Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> --- man2/fanotify_mark.2 | 24 +++++++++++++++++++++--- man7/fanotify.7 | 20 +++++++++++--------- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/man2/fanotify_mark.2 b/man2/fanotify_mark.2 index a9a482fe7..3862a8e34 100644 --- a/man2/fanotify_mark.2 +++ b/man2/fanotify_mark.2 @@ -70,15 +70,23 @@ must be nonempty or the error will occur. .TP .B FAN_MARK_FLUSH -Remove either all mount or all non-mount marks from the fanotify group. +Remove either all marks for filesystems, all marks for mounts or all +marks for directories and files from the fanotify group. If .I flags contains .BR FAN_MARK_MOUNT , all marks for mounts are removed from the group. +If +.I flags +contains +.BR FAN_MARK_FILESYSTEM , +all marks for filesystems are removed from the group. Otherwise, all marks for directories and files are removed. -No flag other than +No flag other than and only one of the flags .B FAN_MARK_MOUNT +or +.B FAN_MARK_FILESYSTEM can be used in conjunction with .BR FAN_MARK_FLUSH . .I mask @@ -119,6 +127,16 @@ will be marked. All directories, subdirectories, and the contained files of the mount point will be monitored. .TP +.BR FAN_MARK_FILESYSTEM " (since Linux 4.20)" +.\" commit d54f4fba889b205e9cd8239182ca5d27d0ac3bc2 +Mark the filesystem specified by +.IR pathname . +The filesystem containing +.I pathname +will be marked. +All the contained files and directories of the filesystem from any mount +point will be monitored. +.TP .B FAN_MARK_IGNORED_MASK The events in .I mask @@ -183,7 +201,7 @@ Without this flag, only events for files are created. .TP .B FAN_EVENT_ON_CHILD Events for the immediate children of marked directories shall be created. -The flag has no effect when marking mounts. +The flag has no effect when marking mounts and filesystems. Note that events are not generated for children of the subdirectories of marked directories. To monitor complete directory trees it is necessary to mark the relevant diff --git a/man7/fanotify.7 b/man7/fanotify.7 index 0c417c07e..ec5532f55 100644 --- a/man7/fanotify.7 +++ b/man7/fanotify.7 @@ -56,8 +56,8 @@ system call creates and initializes an fanotify notification group and returns a file descriptor referring to it. .PP An fanotify notification group is a kernel-internal object that holds -a list of files, directories, and mount points for which events shall be -created. +a list of files, directories, filesystems and mount points for which +events shall be created. .PP For each entry in an fanotify notification group, two bit masks exist: the .I mark @@ -66,14 +66,14 @@ mask and the mask. The mark mask defines file activities for which an event shall be created. The ignore mask defines activities for which no event shall be generated. -Having these two types of masks permits a mount point or directory to be -marked for receiving events, while at the same time ignoring events for -specific objects under that mount point or directory. +Having these two types of masks permits a filesystem, mount point or +directory to be marked for receiving events, while at the same time +ignoring events for specific objects under a mount point or directory. .PP The .BR fanotify_mark (2) -system call adds a file, directory, or mount to a notification group -and specifies which events +system call adds a file, directory, filesystem or mount point to a +notification group and specifies which events shall be reported (or ignored), or removes or modifies such an entry. .PP A possible usage of the ignore mask is for a file cache. @@ -93,8 +93,8 @@ The entries in the fanotify notification groups refer to files and directories via their inode number and to mounts via their mount ID. If files or directories are renamed or moved within the same mount, the respective entries survive. -If files or directories are deleted or moved to another mount or if mounts are -unmounted, the corresponding entries are deleted. +If files or directories are deleted or moved to another mount or if +filesystems or mounts are unmounted, the corresponding entries are deleted. .SS The event queue As events occur on the filesystem objects monitored by a notification group, the fanotify system generates events that are collected in a queue. @@ -481,6 +481,8 @@ additional marks must be created. subdirectory has been created under a marked directory, which makes recursive monitoring difficult.) Monitoring mounts offers the capability to monitor a whole directory tree. +Monitoring filesystems offers the capability to monitor changes made from +any mount of a filesystem instance. .PP The event queue can overflow. In this case, events are lost. -- 2.17.1
From 43dbe7771199d3be63cedbc6895675560216b353 Mon Sep 17 00:00:00 2001 From: nixiaoming <nixiaoming@xxxxxxxxxx> Date: Sat, 22 Sep 2018 09:51:46 +0800 Subject: [PATCH 2/2] fanotify: Document FAN_REPORT_TID fanotify_init.2 add new flags FAN_REPORT_TID fanotify.7 update description of member pid in struct fanotify_event_metadata [amir: renamed flag to FAN_REPORT_TID and editing] Signed-off-by: nixiaoming <nixiaoming@xxxxxxxxxx> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> --- man2/fanotify_init.2 | 4 ++++ man7/fanotify.7 | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/man2/fanotify_init.2 b/man2/fanotify_init.2 index e3a0b9854..94d0292f6 100644 --- a/man2/fanotify_init.2 +++ b/man2/fanotify_init.2 @@ -142,6 +142,10 @@ Remove the limit of 8192 marks. Use of this flag requires the .B CAP_SYS_ADMIN capability. +.TP +.BR FAN_REPORT_TID " (since Linux 4.20)" +.\" commit d0a6a87e40da49cfc7954c491d3065a25a641b29 +Report thread id (TID) instead of process id (PID). .PP The .I event_f_flags diff --git a/man7/fanotify.7 b/man7/fanotify.7 index ec5532f55..c52aadeda 100644 --- a/man7/fanotify.7 +++ b/man7/fanotify.7 @@ -223,7 +223,13 @@ Hence, when the receiver of the fanotify event accesses the notified file or directory using this file descriptor, no additional events will be created. .TP .I pid -This is the ID of the process that caused the event. +If flag +.B FAN_REPORT_TID +was set in +.BR fanotify_init (2), +this is the TID of the thread that caused the event. +Otherwise, this the PID of the process that caused the event. +.PP A program listening to fanotify events can compare this PID to the PID returned by .BR getpid (2), -- 2.17.1