mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
fsnotify: generate FS_RENAME event with rich information
The dnotify FS_DN_RENAME event is used to request notification about a move within the same parent directory and was always coupled with the FS_MOVED_FROM event. Rename the FS_DN_RENAME event flag to FS_RENAME, decouple it from FS_MOVED_FROM and report it with the moved dentry instead of the moved inode, so it has the information about both old and new parent and name. Generate the FS_RENAME event regardless of same parent dir and apply the "same parent" rule in the generic fsnotify_handle_event() helper that is used to call backends with ->handle_inode_event() method (i.e. dnotify). The ->handle_inode_event() method is not rich enough to report both old and new parent and name anyway. The enriched event is reported to fanotify over the ->handle_event() method with the old and new dir inode marks in marks array slots for ITER_TYPE_INODE and a new iter type slot ITER_TYPE_INODE2. The enriched event will be used for reporting old and new parent+name to fanotify groups with FAN_RENAME events. Link: https://lore.kernel.org/r/20211129201537.1932819-5-amir73il@gmail.com Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
d61fd650e9
commit
e54183fa70
5 changed files with 41 additions and 16 deletions
|
@ -63,7 +63,7 @@
|
|||
*/
|
||||
#define FS_EVENT_ON_CHILD 0x08000000
|
||||
|
||||
#define FS_DN_RENAME 0x10000000 /* file renamed */
|
||||
#define FS_RENAME 0x10000000 /* File was renamed */
|
||||
#define FS_DN_MULTISHOT 0x20000000 /* dnotify multishot */
|
||||
#define FS_ISDIR 0x40000000 /* event occurred against dir */
|
||||
#define FS_IN_ONESHOT 0x80000000 /* only send event once */
|
||||
|
@ -76,7 +76,7 @@
|
|||
* The watching parent may get an FS_ATTRIB|FS_EVENT_ON_CHILD event
|
||||
* when a directory entry inside a child subdir changes.
|
||||
*/
|
||||
#define ALL_FSNOTIFY_DIRENT_EVENTS (FS_CREATE | FS_DELETE | FS_MOVE)
|
||||
#define ALL_FSNOTIFY_DIRENT_EVENTS (FS_CREATE | FS_DELETE | FS_MOVE | FS_RENAME)
|
||||
|
||||
#define ALL_FSNOTIFY_PERM_EVENTS (FS_OPEN_PERM | FS_ACCESS_PERM | \
|
||||
FS_OPEN_EXEC_PERM)
|
||||
|
@ -101,7 +101,7 @@
|
|||
/* Events that can be reported to backends */
|
||||
#define ALL_FSNOTIFY_EVENTS (ALL_FSNOTIFY_DIRENT_EVENTS | \
|
||||
FS_EVENTS_POSS_ON_CHILD | \
|
||||
FS_DELETE_SELF | FS_MOVE_SELF | FS_DN_RENAME | \
|
||||
FS_DELETE_SELF | FS_MOVE_SELF | \
|
||||
FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \
|
||||
FS_ERROR)
|
||||
|
||||
|
@ -349,6 +349,7 @@ enum fsnotify_iter_type {
|
|||
FSNOTIFY_ITER_TYPE_VFSMOUNT,
|
||||
FSNOTIFY_ITER_TYPE_SB,
|
||||
FSNOTIFY_ITER_TYPE_PARENT,
|
||||
FSNOTIFY_ITER_TYPE_INODE2,
|
||||
FSNOTIFY_ITER_TYPE_COUNT
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue