Skip to content

Commit eb65405

Browse files
committed
Merge tag 'fsnotify_for_v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull fsnotify updates from Jan Kara: - fanotify fix for softlockups when there are many queued events - performance improvement to reduce fsnotify overhead when not used - Amir's implementation of fanotify events with names. With these you can now efficiently monitor whole filesystem, eg to mirror changes to another machine. * tag 'fsnotify_for_v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: (37 commits) fanotify: compare fsid when merging name event fsnotify: create method handle_inode_event() in fsnotify_operations fanotify: report parent fid + child fid fanotify: report parent fid + name + child fid fanotify: add support for FAN_REPORT_NAME fanotify: report events with parent dir fid to sb/mount/non-dir marks fanotify: add basic support for FAN_REPORT_DIR_FID fsnotify: remove check that source dentry is positive fsnotify: send event with parent/name info to sb/mount/non-dir marks audit: do not set FS_EVENT_ON_CHILD in audit marks mask inotify: do not set FS_EVENT_ON_CHILD in non-dir mark mask fsnotify: pass dir and inode arguments to fsnotify() fsnotify: create helper fsnotify_inode() fsnotify: send event to parent and child with single callback inotify: report both events on parent and child with single callback dnotify: report both events on parent and child with single callback fanotify: no external fh buffer in fanotify_name_event fanotify: use struct fanotify_info to parcel the variable size buffer fsnotify: add object type "child" to object type iterator fanotify: use FAN_EVENT_ON_CHILD as implicit flag on sb/mount/non-dir marks ...
2 parents 09e70bb + 8aed8ce commit eb65405

File tree

18 files changed

+966
-424
lines changed

18 files changed

+966
-424
lines changed

fs/kernfs/file.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
883883

884884
list_for_each_entry(info, &kernfs_root(kn)->supers, node) {
885885
struct kernfs_node *parent;
886+
struct inode *p_inode = NULL;
886887
struct inode *inode;
887888
struct qstr name;
888889

@@ -899,20 +900,20 @@ static void kernfs_notify_workfn(struct work_struct *work)
899900
name = (struct qstr)QSTR_INIT(kn->name, strlen(kn->name));
900901
parent = kernfs_get_parent(kn);
901902
if (parent) {
902-
struct inode *p_inode;
903-
904903
p_inode = ilookup(info->sb, kernfs_ino(parent));
905904
if (p_inode) {
906-
fsnotify(p_inode, FS_MODIFY | FS_EVENT_ON_CHILD,
907-
inode, FSNOTIFY_EVENT_INODE, &name, 0);
905+
fsnotify(FS_MODIFY | FS_EVENT_ON_CHILD,
906+
inode, FSNOTIFY_EVENT_INODE,
907+
p_inode, &name, inode, 0);
908908
iput(p_inode);
909909
}
910910

911911
kernfs_put(parent);
912912
}
913913

914-
fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE,
915-
&name, 0);
914+
if (!p_inode)
915+
fsnotify_inode(inode, FS_MODIFY);
916+
916917
iput(inode);
917918
}
918919

fs/nfsd/filecache.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -598,11 +598,9 @@ static struct notifier_block nfsd_file_lease_notifier = {
598598
};
599599

600600
static int
601-
nfsd_file_fsnotify_handle_event(struct fsnotify_group *group,
602-
struct inode *inode,
603-
u32 mask, const void *data, int data_type,
604-
const struct qstr *file_name, u32 cookie,
605-
struct fsnotify_iter_info *iter_info)
601+
nfsd_file_fsnotify_handle_event(struct fsnotify_mark *mark, u32 mask,
602+
struct inode *inode, struct inode *dir,
603+
const struct qstr *name)
606604
{
607605
trace_nfsd_file_fsnotify_handle_event(inode, mask);
608606

@@ -624,7 +622,7 @@ nfsd_file_fsnotify_handle_event(struct fsnotify_group *group,
624622

625623

626624
static const struct fsnotify_ops nfsd_file_fsnotify_ops = {
627-
.handle_event = nfsd_file_fsnotify_handle_event,
625+
.handle_inode_event = nfsd_file_fsnotify_handle_event,
628626
.free_mark = nfsd_file_mark_free,
629627
};
630628

fs/notify/dnotify/dnotify.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,24 +70,18 @@ static void dnotify_recalc_inode_mask(struct fsnotify_mark *fsn_mark)
7070
* destroy the dnotify struct if it was not registered to receive multiple
7171
* events.
7272
*/
73-
static int dnotify_handle_event(struct fsnotify_group *group,
74-
struct inode *inode,
75-
u32 mask, const void *data, int data_type,
76-
const struct qstr *file_name, u32 cookie,
77-
struct fsnotify_iter_info *iter_info)
73+
static int dnotify_handle_event(struct fsnotify_mark *inode_mark, u32 mask,
74+
struct inode *inode, struct inode *dir,
75+
const struct qstr *name)
7876
{
79-
struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info);
8077
struct dnotify_mark *dn_mark;
8178
struct dnotify_struct *dn;
8279
struct dnotify_struct **prev;
8380
struct fown_struct *fown;
8481
__u32 test_mask = mask & ~FS_EVENT_ON_CHILD;
8582

8683
/* not a dir, dnotify doesn't care */
87-
if (!S_ISDIR(inode->i_mode))
88-
return 0;
89-
90-
if (WARN_ON(fsnotify_iter_vfsmount_mark(iter_info)))
84+
if (!dir && !(mask & FS_ISDIR))
9185
return 0;
9286

9387
dn_mark = container_of(inode_mark, struct dnotify_mark, fsn_mark);
@@ -127,7 +121,7 @@ static void dnotify_free_mark(struct fsnotify_mark *fsn_mark)
127121
}
128122

129123
static const struct fsnotify_ops dnotify_fsnotify_ops = {
130-
.handle_event = dnotify_handle_event,
124+
.handle_inode_event = dnotify_handle_event,
131125
.free_mark = dnotify_free_mark,
132126
};
133127

0 commit comments

Comments
 (0)