Skip to content

Commit 08b95c3

Browse files
amir73iljankara
authored andcommitted
fanotify: remove event FAN_DIR_MODIFY
It was never enabled in uapi and its functionality is about to be superseded by events FAN_CREATE, FAN_DELETE, FAN_MOVE with group flag FAN_REPORT_NAME. Keep a place holder variable name_event instead of removing the name recording code since it will be used by the new events. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Amir Goldstein <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent b54cecf commit 08b95c3

File tree

5 files changed

+4
-18
lines changed

5 files changed

+4
-18
lines changed

fs/notify/fanotify/fanotify.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ static struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group,
425425
gfp_t gfp = GFP_KERNEL_ACCOUNT;
426426
struct inode *id = fanotify_fid_inode(mask, data, data_type, dir);
427427
const struct path *path = fsnotify_data_path(data, data_type);
428+
bool name_event = false;
428429

429430
/*
430431
* For queues with unlimited length lost events are not expected and
@@ -442,12 +443,7 @@ static struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group,
442443

443444
if (fanotify_is_perm_event(mask)) {
444445
event = fanotify_alloc_perm_event(path, gfp);
445-
} else if (mask & FAN_DIR_MODIFY && !(WARN_ON_ONCE(!file_name))) {
446-
/*
447-
* For FAN_DIR_MODIFY event, we report the fid of the directory
448-
* and the name of the modified entry.
449-
* Allocate an fanotify_name_event struct and copy the name.
450-
*/
446+
} else if (name_event && file_name) {
451447
event = fanotify_alloc_name_event(id, fsid, file_name, gfp);
452448
} else if (FAN_GROUP_FLAG(group, FAN_REPORT_FID)) {
453449
event = fanotify_alloc_fid_event(id, fsid, gfp);
@@ -528,7 +524,6 @@ static int fanotify_handle_event(struct fsnotify_group *group, u32 mask,
528524
BUILD_BUG_ON(FAN_MOVED_FROM != FS_MOVED_FROM);
529525
BUILD_BUG_ON(FAN_CREATE != FS_CREATE);
530526
BUILD_BUG_ON(FAN_DELETE != FS_DELETE);
531-
BUILD_BUG_ON(FAN_DIR_MODIFY != FS_DIR_MODIFY);
532527
BUILD_BUG_ON(FAN_DELETE_SELF != FS_DELETE_SELF);
533528
BUILD_BUG_ON(FAN_MOVE_SELF != FS_MOVE_SELF);
534529
BUILD_BUG_ON(FAN_EVENT_ON_CHILD != FS_EVENT_ON_CHILD);

fs/notify/fsnotify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ static __init int fsnotify_init(void)
393393
{
394394
int ret;
395395

396-
BUILD_BUG_ON(HWEIGHT32(ALL_FSNOTIFY_BITS) != 26);
396+
BUILD_BUG_ON(HWEIGHT32(ALL_FSNOTIFY_BITS) != 25);
397397

398398
ret = init_srcu_struct(&fsnotify_mark_srcu);
399399
if (ret)

include/linux/fsnotify.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ static inline void fsnotify_name(struct inode *dir, __u32 mask,
3030
const struct qstr *name, u32 cookie)
3131
{
3232
fsnotify(dir, mask, child, FSNOTIFY_EVENT_INODE, name, cookie);
33-
/*
34-
* Send another flavor of the event without child inode data and
35-
* without the specific event type (e.g. FS_CREATE|FS_IS_DIR).
36-
* The name is relative to the dir inode the event is reported to.
37-
*/
38-
fsnotify(dir, FS_DIR_MODIFY, dir, FSNOTIFY_EVENT_INODE, name, 0);
3933
}
4034

4135
static inline void fsnotify_dirent(struct inode *dir, struct dentry *dentry,

include/linux/fsnotify_backend.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
#define FS_OPEN_PERM 0x00010000 /* open event in an permission hook */
4848
#define FS_ACCESS_PERM 0x00020000 /* access event in a permissions hook */
4949
#define FS_OPEN_EXEC_PERM 0x00040000 /* open/exec event in a permission hook */
50-
#define FS_DIR_MODIFY 0x00080000 /* Directory entry was modified */
5150

5251
#define FS_EXCL_UNLINK 0x04000000 /* do not send events if object is unlinked */
5352
/* This inode cares about things that happen to its children. Always set for
@@ -67,8 +66,7 @@
6766
* The watching parent may get an FS_ATTRIB|FS_EVENT_ON_CHILD event
6867
* when a directory entry inside a child subdir changes.
6968
*/
70-
#define ALL_FSNOTIFY_DIRENT_EVENTS (FS_CREATE | FS_DELETE | FS_MOVE | \
71-
FS_DIR_MODIFY)
69+
#define ALL_FSNOTIFY_DIRENT_EVENTS (FS_CREATE | FS_DELETE | FS_MOVE)
7270

7371
#define ALL_FSNOTIFY_PERM_EVENTS (FS_OPEN_PERM | FS_ACCESS_PERM | \
7472
FS_OPEN_EXEC_PERM)

include/uapi/linux/fanotify.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#define FAN_OPEN_PERM 0x00010000 /* File open in perm check */
2525
#define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */
2626
#define FAN_OPEN_EXEC_PERM 0x00040000 /* File open/exec in perm check */
27-
#define FAN_DIR_MODIFY 0x00080000 /* Directory entry was modified */
2827

2928
#define FAN_EVENT_ON_CHILD 0x08000000 /* Interested in child events */
3029

0 commit comments

Comments
 (0)