summaryrefslogtreecommitdiffstats
path: root/fs/notify/notification.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-07-28 16:18:37 +0200
committerEric Paris <eparis@redhat.com>2010-07-28 16:18:51 +0200
commit3bcf3860a4ff9bbc522820b4b765e65e4deceb3e (patch)
tree1e235af133559062c6fdee840ff9698f1dee26a6 /fs/notify/notification.c
parentfsnotify: fsnotify_add_notify_event should return an event (diff)
downloadlinux-3bcf3860a4ff9bbc522820b4b765e65e4deceb3e.tar.xz
linux-3bcf3860a4ff9bbc522820b4b765e65e4deceb3e.zip
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/notification.c')
-rw-r--r--fs/notify/notification.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/fs/notify/notification.c b/fs/notify/notification.c
index f39260f8f865..c106cdd7ff5e 100644
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@ -31,6 +31,7 @@
* allocated and used.
*/
+#include <linux/file.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/kernel.h>
@@ -89,8 +90,8 @@ void fsnotify_put_event(struct fsnotify_event *event)
if (atomic_dec_and_test(&event->refcnt)) {
pr_debug("%s: event=%p\n", __func__, event);
- if (event->data_type == FSNOTIFY_EVENT_PATH)
- path_put(&event->path);
+ if (event->data_type == FSNOTIFY_EVENT_FILE)
+ fput(event->file);
BUG_ON(!list_empty(&event->private_data_list));
@@ -375,8 +376,8 @@ struct fsnotify_event *fsnotify_clone_event(struct fsnotify_event *old_event)
}
}
event->tgid = get_pid(old_event->tgid);
- if (event->data_type == FSNOTIFY_EVENT_PATH)
- path_get(&event->path);
+ if (event->data_type == FSNOTIFY_EVENT_FILE)
+ get_file(event->file);
return event;
}
@@ -423,11 +424,9 @@ struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
event->data_type = data_type;
switch (data_type) {
- case FSNOTIFY_EVENT_PATH: {
- struct path *path = data;
- event->path.dentry = path->dentry;
- event->path.mnt = path->mnt;
- path_get(&event->path);
+ case FSNOTIFY_EVENT_FILE: {
+ event->file = data;
+ get_file(event->file);
break;
}
case FSNOTIFY_EVENT_INODE:
@@ -435,8 +434,7 @@ struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
break;
case FSNOTIFY_EVENT_NONE:
event->inode = NULL;
- event->path.dentry = NULL;
- event->path.mnt = NULL;
+ event->file = NULL;
break;
default:
BUG();