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 /include/linux/fsnotify_backend.h | |
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 'include/linux/fsnotify_backend.h')
-rw-r--r-- | include/linux/fsnotify_backend.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 564b5ea4a831..3410d388163e 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -223,20 +223,20 @@ struct fsnotify_event { | |||
223 | /* to_tell may ONLY be dereferenced during handle_event(). */ | 223 | /* to_tell may ONLY be dereferenced during handle_event(). */ |
224 | struct inode *to_tell; /* either the inode the event happened to or its parent */ | 224 | struct inode *to_tell; /* either the inode the event happened to or its parent */ |
225 | /* | 225 | /* |
226 | * depending on the event type we should have either a path or inode | 226 | * depending on the event type we should have either a file or inode |
227 | * We hold a reference on path, but NOT on inode. Since we have the ref on | 227 | * We hold a reference on file, but NOT on inode. Since we have the ref on |
228 | * the path, it may be dereferenced at any point during this object's | 228 | * the file, it may be dereferenced at any point during this object's |
229 | * lifetime. That reference is dropped when this object's refcnt hits | 229 | * lifetime. That reference is dropped when this object's refcnt hits |
230 | * 0. If this event contains an inode instead of a path, the inode may | 230 | * 0. If this event contains an inode instead of a file, the inode may |
231 | * ONLY be used during handle_event(). | 231 | * ONLY be used during handle_event(). |
232 | */ | 232 | */ |
233 | union { | 233 | union { |
234 | struct path path; | 234 | struct file *file; |
235 | struct inode *inode; | 235 | struct inode *inode; |
236 | }; | 236 | }; |
237 | /* when calling fsnotify tell it if the data is a path or inode */ | 237 | /* when calling fsnotify tell it if the data is a path or inode */ |
238 | #define FSNOTIFY_EVENT_NONE 0 | 238 | #define FSNOTIFY_EVENT_NONE 0 |
239 | #define FSNOTIFY_EVENT_PATH 1 | 239 | #define FSNOTIFY_EVENT_FILE 1 |
240 | #define FSNOTIFY_EVENT_INODE 2 | 240 | #define FSNOTIFY_EVENT_INODE 2 |
241 | int data_type; /* which of the above union we have */ | 241 | int data_type; /* which of the above union we have */ |
242 | atomic_t refcnt; /* how many groups still are using/need to send this event */ | 242 | atomic_t refcnt; /* how many groups still are using/need to send this event */ |
@@ -311,7 +311,7 @@ struct fsnotify_mark { | |||
311 | /* main fsnotify call to send events */ | 311 | /* main fsnotify call to send events */ |
312 | extern int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, | 312 | extern int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, |
313 | const unsigned char *name, u32 cookie); | 313 | const unsigned char *name, u32 cookie); |
314 | extern void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask); | 314 | extern void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask); |
315 | extern void __fsnotify_inode_delete(struct inode *inode); | 315 | extern void __fsnotify_inode_delete(struct inode *inode); |
316 | extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); | 316 | extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); |
317 | extern u32 fsnotify_get_cookie(void); | 317 | extern u32 fsnotify_get_cookie(void); |
@@ -444,7 +444,7 @@ static inline int fsnotify(struct inode *to_tell, __u32 mask, void *data, int da | |||
444 | return 0; | 444 | return 0; |
445 | } | 445 | } |
446 | 446 | ||
447 | static inline void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) | 447 | static inline void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask) |
448 | {} | 448 | {} |
449 | 449 | ||
450 | static inline void __fsnotify_inode_delete(struct inode *inode) | 450 | static inline void __fsnotify_inode_delete(struct inode *inode) |