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/fsnotify.c | |
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/fsnotify.c')
-rw-r--r-- | fs/notify/fsnotify.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 72aae4045314..4788c866473a 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c | |||
@@ -84,7 +84,7 @@ void __fsnotify_update_child_dentry_flags(struct inode *inode) | |||
84 | } | 84 | } |
85 | 85 | ||
86 | /* Notify this dentry's parent about a child's events. */ | 86 | /* Notify this dentry's parent about a child's events. */ |
87 | void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) | 87 | void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask) |
88 | { | 88 | { |
89 | struct dentry *parent; | 89 | struct dentry *parent; |
90 | struct inode *p_inode; | 90 | struct inode *p_inode; |
@@ -92,7 +92,7 @@ void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) | |||
92 | bool should_update_children = false; | 92 | bool should_update_children = false; |
93 | 93 | ||
94 | if (!dentry) | 94 | if (!dentry) |
95 | dentry = path->dentry; | 95 | dentry = file->f_path.dentry; |
96 | 96 | ||
97 | if (!(dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED)) | 97 | if (!(dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED)) |
98 | return; | 98 | return; |
@@ -124,8 +124,8 @@ void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) | |||
124 | * specifies these are events which came from a child. */ | 124 | * specifies these are events which came from a child. */ |
125 | mask |= FS_EVENT_ON_CHILD; | 125 | mask |= FS_EVENT_ON_CHILD; |
126 | 126 | ||
127 | if (path) | 127 | if (file) |
128 | fsnotify(p_inode, mask, path, FSNOTIFY_EVENT_PATH, | 128 | fsnotify(p_inode, mask, file, FSNOTIFY_EVENT_FILE, |
129 | dentry->d_name.name, 0); | 129 | dentry->d_name.name, 0); |
130 | else | 130 | else |
131 | fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE, | 131 | fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE, |
@@ -154,10 +154,10 @@ void __fsnotify_flush_ignored_mask(struct inode *inode, void *data, int data_is) | |||
154 | spin_unlock(&inode->i_lock); | 154 | spin_unlock(&inode->i_lock); |
155 | } | 155 | } |
156 | 156 | ||
157 | if (data_is == FSNOTIFY_EVENT_PATH) { | 157 | if (data_is == FSNOTIFY_EVENT_FILE) { |
158 | struct vfsmount *mnt; | 158 | struct vfsmount *mnt; |
159 | 159 | ||
160 | mnt = ((struct path *)data)->mnt; | 160 | mnt = ((struct file *)data)->f_path.mnt; |
161 | if (mnt && !hlist_empty(&mnt->mnt_fsnotify_marks)) { | 161 | if (mnt && !hlist_empty(&mnt->mnt_fsnotify_marks)) { |
162 | spin_lock(&mnt->mnt_root->d_lock); | 162 | spin_lock(&mnt->mnt_root->d_lock); |
163 | hlist_for_each_entry(mark, node, &mnt->mnt_fsnotify_marks, m.m_list) { | 163 | hlist_for_each_entry(mark, node, &mnt->mnt_fsnotify_marks, m.m_list) { |
@@ -228,8 +228,8 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, | |||
228 | !(test_mask & fsnotify_vfsmount_mask)) | 228 | !(test_mask & fsnotify_vfsmount_mask)) |
229 | return 0; | 229 | return 0; |
230 | 230 | ||
231 | if (data_is == FSNOTIFY_EVENT_PATH) | 231 | if (data_is == FSNOTIFY_EVENT_FILE) |
232 | mnt = ((struct path *)data)->mnt; | 232 | mnt = ((struct file *)data)->f_path.mnt; |
233 | 233 | ||
234 | /* if this inode's directed listeners don't care and nothing on the vfsmount | 234 | /* if this inode's directed listeners don't care and nothing on the vfsmount |
235 | * listeners list cares, nothing to do */ | 235 | * listeners list cares, nothing to do */ |