From dbe2aaabda3196a1ec547ad6252e711909a363e9 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Thu, 17 Dec 2009 21:24:27 -0500 Subject: [PATCH] --- yaml --- r: 207663 b: refs/heads/master c: 32c3263221bd63316815286dccacdc7abfd7f3c4 h: refs/heads/master i: 207661: d3911e37cd1e800875c2f3fd37127e5047812ae4 207659: dd5eb5d584a88299a7ab02b68626097dcd6909a4 207655: b6ac4b5e5ac846048bbfb9f47d939352ccab781f 207647: 006ebccfd2960e66ea1e632e1b1a9b71c7b01e19 v: v3 --- [refs] | 2 +- trunk/fs/notify/fanotify/fanotify.c | 5 +++-- trunk/fs/notify/fanotify/fanotify_user.c | 1 + trunk/fs/notify/notification.c | 3 +++ trunk/include/linux/fanotify.h | 1 + trunk/include/linux/fsnotify_backend.h | 1 + 6 files changed, 10 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 23eed1b9fa6a..ae8c588fae75 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 22aa425dec9e47051624714ae283eb2b6a473013 +refs/heads/master: 32c3263221bd63316815286dccacdc7abfd7f3c4 diff --git a/trunk/fs/notify/fanotify/fanotify.c b/trunk/fs/notify/fanotify/fanotify.c index 5b0b6b485a9c..881067dc7923 100644 --- a/trunk/fs/notify/fanotify/fanotify.c +++ b/trunk/fs/notify/fanotify/fanotify.c @@ -10,8 +10,9 @@ static bool should_merge(struct fsnotify_event *old, struct fsnotify_event *new) { pr_debug("%s: old=%p new=%p\n", __func__, old, new); - if ((old->to_tell == new->to_tell) && - (old->data_type == new->data_type)) { + if (old->to_tell == new->to_tell && + old->data_type == new->data_type && + old->tgid == new->tgid) { switch (old->data_type) { case (FSNOTIFY_EVENT_PATH): if ((old->path.mnt == new->path.mnt) && diff --git a/trunk/fs/notify/fanotify/fanotify_user.c b/trunk/fs/notify/fanotify/fanotify_user.c index cf9c30009825..66e38fc052b2 100644 --- a/trunk/fs/notify/fanotify/fanotify_user.c +++ b/trunk/fs/notify/fanotify/fanotify_user.c @@ -103,6 +103,7 @@ static ssize_t fill_event_metadata(struct fsnotify_group *group, metadata->event_len = FAN_EVENT_METADATA_LEN; metadata->vers = FANOTIFY_METADATA_VERSION; metadata->mask = fanotify_outgoing_mask(event->mask); + metadata->pid = pid_vnr(event->tgid); metadata->fd = create_fd(group, event); return metadata->fd; diff --git a/trunk/fs/notify/notification.c b/trunk/fs/notify/notification.c index 066f1f988bac..7fc8d004084c 100644 --- a/trunk/fs/notify/notification.c +++ b/trunk/fs/notify/notification.c @@ -93,6 +93,7 @@ void fsnotify_put_event(struct fsnotify_event *event) BUG_ON(!list_empty(&event->private_data_list)); kfree(event->file_name); + put_pid(event->tgid); kmem_cache_free(fsnotify_event_cachep, event); } } @@ -346,6 +347,7 @@ struct fsnotify_event *fsnotify_clone_event(struct fsnotify_event *old_event) return NULL; } } + event->tgid = get_pid(old_event->tgid); if (event->data_type == FSNOTIFY_EVENT_PATH) path_get(&event->path); @@ -385,6 +387,7 @@ struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask, event->name_len = strlen(event->file_name); } + event->tgid = get_pid(task_tgid(current)); event->sync_cookie = cookie; event->to_tell = to_tell; event->data_type = data_type; diff --git a/trunk/include/linux/fanotify.h b/trunk/include/linux/fanotify.h index c1c66162a46c..5f633af4d1b0 100644 --- a/trunk/include/linux/fanotify.h +++ b/trunk/include/linux/fanotify.h @@ -62,6 +62,7 @@ struct fanotify_event_metadata { __u32 vers; __s32 fd; __u64 mask; + __s64 pid; } __attribute__ ((packed)); /* Helper functions to deal with fanotify_event_metadata buffers */ diff --git a/trunk/include/linux/fsnotify_backend.h b/trunk/include/linux/fsnotify_backend.h index ff654c1932f2..7d93572ec568 100644 --- a/trunk/include/linux/fsnotify_backend.h +++ b/trunk/include/linux/fsnotify_backend.h @@ -221,6 +221,7 @@ struct fsnotify_event { u32 sync_cookie; /* used to corrolate events, namely inotify mv events */ char *file_name; size_t name_len; + struct pid *tgid; struct list_head private_data_list; /* groups can store private data here */ };