diff options
author | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:37 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:51 -0400 |
commit | 3bcf3860a4ff9bbc522820b4b765e65e4deceb3e (patch) | |
tree | 1e235af133559062c6fdee840ff9698f1dee26a6 /fs/notify/fanotify | |
parent | f70ab54cc6c3907b0727ba332b3976f80f3846d0 (diff) |
fsnotify: store struct file not struct path
Al explains that calling dentry_open() with a mnt/dentry pair is only
garunteed to be safe if they are already used in an open struct file. To
make sure this is the case don't store and use a struct path in fsnotify,
always use a struct file.
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify/fanotify')
-rw-r--r-- | fs/notify/fanotify/fanotify.c | 8 | ||||
-rw-r--r-- | fs/notify/fanotify/fanotify_user.c | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index f3c40c0e2b86..c2a3029052bc 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c | |||
@@ -17,9 +17,9 @@ static bool should_merge(struct fsnotify_event *old, struct fsnotify_event *new) | |||
17 | old->data_type == new->data_type && | 17 | old->data_type == new->data_type && |
18 | old->tgid == new->tgid) { | 18 | old->tgid == new->tgid) { |
19 | switch (old->data_type) { | 19 | switch (old->data_type) { |
20 | case (FSNOTIFY_EVENT_PATH): | 20 | case (FSNOTIFY_EVENT_FILE): |
21 | if ((old->path.mnt == new->path.mnt) && | 21 | if ((old->file->f_path.mnt == new->file->f_path.mnt) && |
22 | (old->path.dentry == new->path.dentry)) | 22 | (old->file->f_path.dentry == new->file->f_path.dentry)) |
23 | return true; | 23 | return true; |
24 | case (FSNOTIFY_EVENT_NONE): | 24 | case (FSNOTIFY_EVENT_NONE): |
25 | return true; | 25 | return true; |
@@ -226,7 +226,7 @@ static bool fanotify_should_send_event(struct fsnotify_group *group, struct inod | |||
226 | return false; | 226 | return false; |
227 | 227 | ||
228 | /* if we don't have enough info to send an event to userspace say no */ | 228 | /* if we don't have enough info to send an event to userspace say no */ |
229 | if (data_type != FSNOTIFY_EVENT_PATH) | 229 | if (data_type != FSNOTIFY_EVENT_FILE) |
230 | return false; | 230 | return false; |
231 | 231 | ||
232 | if (mnt) | 232 | if (mnt) |
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 7182c83be90e..50cea74bf1c8 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c | |||
@@ -65,7 +65,7 @@ static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event) | |||
65 | if (client_fd < 0) | 65 | if (client_fd < 0) |
66 | return client_fd; | 66 | return client_fd; |
67 | 67 | ||
68 | if (event->data_type != FSNOTIFY_EVENT_PATH) { | 68 | if (event->data_type != FSNOTIFY_EVENT_FILE) { |
69 | WARN_ON(1); | 69 | WARN_ON(1); |
70 | put_unused_fd(client_fd); | 70 | put_unused_fd(client_fd); |
71 | return -EINVAL; | 71 | return -EINVAL; |
@@ -75,8 +75,8 @@ static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event) | |||
75 | * we need a new file handle for the userspace program so it can read even if it was | 75 | * we need a new file handle for the userspace program so it can read even if it was |
76 | * originally opened O_WRONLY. | 76 | * originally opened O_WRONLY. |
77 | */ | 77 | */ |
78 | dentry = dget(event->path.dentry); | 78 | dentry = dget(event->file->f_path.dentry); |
79 | mnt = mntget(event->path.mnt); | 79 | mnt = mntget(event->file->f_path.mnt); |
80 | /* it's possible this event was an overflow event. in that case dentry and mnt | 80 | /* it's possible this event was an overflow event. in that case dentry and mnt |
81 | * are NULL; That's fine, just don't call dentry open */ | 81 | * are NULL; That's fine, just don't call dentry open */ |
82 | if (dentry && mnt) | 82 | if (dentry && mnt) |