aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/notify/fanotify/fanotify.c5
-rw-r--r--fs/notify/fanotify/fanotify_user.c1
-rw-r--r--fs/notify/notification.c3
-rw-r--r--include/linux/fanotify.h1
-rw-r--r--include/linux/fsnotify_backend.h1
5 files changed, 9 insertions, 2 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index 5b0b6b485a9c..881067dc7923 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -10,8 +10,9 @@ static bool should_merge(struct fsnotify_event *old, struct fsnotify_event *new)
10{ 10{
11 pr_debug("%s: old=%p new=%p\n", __func__, old, new); 11 pr_debug("%s: old=%p new=%p\n", __func__, old, new);
12 12
13 if ((old->to_tell == new->to_tell) && 13 if (old->to_tell == new->to_tell &&
14 (old->data_type == new->data_type)) { 14 old->data_type == new->data_type &&
15 old->tgid == new->tgid) {
15 switch (old->data_type) { 16 switch (old->data_type) {
16 case (FSNOTIFY_EVENT_PATH): 17 case (FSNOTIFY_EVENT_PATH):
17 if ((old->path.mnt == new->path.mnt) && 18 if ((old->path.mnt == new->path.mnt) &&
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index cf9c30009825..66e38fc052b2 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -103,6 +103,7 @@ static ssize_t fill_event_metadata(struct fsnotify_group *group,
103 metadata->event_len = FAN_EVENT_METADATA_LEN; 103 metadata->event_len = FAN_EVENT_METADATA_LEN;
104 metadata->vers = FANOTIFY_METADATA_VERSION; 104 metadata->vers = FANOTIFY_METADATA_VERSION;
105 metadata->mask = fanotify_outgoing_mask(event->mask); 105 metadata->mask = fanotify_outgoing_mask(event->mask);
106 metadata->pid = pid_vnr(event->tgid);
106 metadata->fd = create_fd(group, event); 107 metadata->fd = create_fd(group, event);
107 108
108 return metadata->fd; 109 return metadata->fd;
diff --git a/fs/notify/notification.c b/fs/notify/notification.c
index 066f1f988bac..7fc8d004084c 100644
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@ -93,6 +93,7 @@ void fsnotify_put_event(struct fsnotify_event *event)
93 BUG_ON(!list_empty(&event->private_data_list)); 93 BUG_ON(!list_empty(&event->private_data_list));
94 94
95 kfree(event->file_name); 95 kfree(event->file_name);
96 put_pid(event->tgid);
96 kmem_cache_free(fsnotify_event_cachep, event); 97 kmem_cache_free(fsnotify_event_cachep, event);
97 } 98 }
98} 99}
@@ -346,6 +347,7 @@ struct fsnotify_event *fsnotify_clone_event(struct fsnotify_event *old_event)
346 return NULL; 347 return NULL;
347 } 348 }
348 } 349 }
350 event->tgid = get_pid(old_event->tgid);
349 if (event->data_type == FSNOTIFY_EVENT_PATH) 351 if (event->data_type == FSNOTIFY_EVENT_PATH)
350 path_get(&event->path); 352 path_get(&event->path);
351 353
@@ -385,6 +387,7 @@ struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
385 event->name_len = strlen(event->file_name); 387 event->name_len = strlen(event->file_name);
386 } 388 }
387 389
390 event->tgid = get_pid(task_tgid(current));
388 event->sync_cookie = cookie; 391 event->sync_cookie = cookie;
389 event->to_tell = to_tell; 392 event->to_tell = to_tell;
390 event->data_type = data_type; 393 event->data_type = data_type;
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
index c1c66162a46c..5f633af4d1b0 100644
--- a/include/linux/fanotify.h
+++ b/include/linux/fanotify.h
@@ -62,6 +62,7 @@ struct fanotify_event_metadata {
62 __u32 vers; 62 __u32 vers;
63 __s32 fd; 63 __s32 fd;
64 __u64 mask; 64 __u64 mask;
65 __s64 pid;
65} __attribute__ ((packed)); 66} __attribute__ ((packed));
66 67
67/* Helper functions to deal with fanotify_event_metadata buffers */ 68/* Helper functions to deal with fanotify_event_metadata buffers */
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index ff654c1932f2..7d93572ec568 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -221,6 +221,7 @@ struct fsnotify_event {
221 u32 sync_cookie; /* used to corrolate events, namely inotify mv events */ 221 u32 sync_cookie; /* used to corrolate events, namely inotify mv events */
222 char *file_name; 222 char *file_name;
223 size_t name_len; 223 size_t name_len;
224 struct pid *tgid;
224 225
225 struct list_head private_data_list; /* groups can store private data here */ 226 struct list_head private_data_list; /* groups can store private data here */
226}; 227};