diff options
Diffstat (limited to 'include/linux/fsnotify.h')
-rw-r--r-- | include/linux/fsnotify.h | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 59d0df43ff9d..2a53f10712b3 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
@@ -17,7 +17,6 @@ | |||
17 | 17 | ||
18 | /* | 18 | /* |
19 | * fsnotify_d_instantiate - instantiate a dentry for inode | 19 | * fsnotify_d_instantiate - instantiate a dentry for inode |
20 | * Called with dcache_lock held. | ||
21 | */ | 20 | */ |
22 | static inline void fsnotify_d_instantiate(struct dentry *dentry, | 21 | static inline void fsnotify_d_instantiate(struct dentry *dentry, |
23 | struct inode *inode) | 22 | struct inode *inode) |
@@ -26,12 +25,12 @@ static inline void fsnotify_d_instantiate(struct dentry *dentry, | |||
26 | } | 25 | } |
27 | 26 | ||
28 | /* Notify this dentry's parent about a child's events. */ | 27 | /* Notify this dentry's parent about a child's events. */ |
29 | static inline void fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) | 28 | static inline int fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) |
30 | { | 29 | { |
31 | if (!dentry) | 30 | if (!dentry) |
32 | dentry = path->dentry; | 31 | dentry = path->dentry; |
33 | 32 | ||
34 | __fsnotify_parent(path, dentry, mask); | 33 | return __fsnotify_parent(path, dentry, mask); |
35 | } | 34 | } |
36 | 35 | ||
37 | /* simple call site for access decisions */ | 36 | /* simple call site for access decisions */ |
@@ -40,6 +39,7 @@ static inline int fsnotify_perm(struct file *file, int mask) | |||
40 | struct path *path = &file->f_path; | 39 | struct path *path = &file->f_path; |
41 | struct inode *inode = path->dentry->d_inode; | 40 | struct inode *inode = path->dentry->d_inode; |
42 | __u32 fsnotify_mask = 0; | 41 | __u32 fsnotify_mask = 0; |
42 | int ret; | ||
43 | 43 | ||
44 | if (file->f_mode & FMODE_NONOTIFY) | 44 | if (file->f_mode & FMODE_NONOTIFY) |
45 | return 0; | 45 | return 0; |
@@ -52,12 +52,15 @@ static inline int fsnotify_perm(struct file *file, int mask) | |||
52 | else | 52 | else |
53 | BUG(); | 53 | BUG(); |
54 | 54 | ||
55 | ret = fsnotify_parent(path, NULL, fsnotify_mask); | ||
56 | if (ret) | ||
57 | return ret; | ||
58 | |||
55 | return fsnotify(inode, fsnotify_mask, path, FSNOTIFY_EVENT_PATH, NULL, 0); | 59 | return fsnotify(inode, fsnotify_mask, path, FSNOTIFY_EVENT_PATH, NULL, 0); |
56 | } | 60 | } |
57 | 61 | ||
58 | /* | 62 | /* |
59 | * fsnotify_d_move - dentry has been moved | 63 | * fsnotify_d_move - dentry has been moved |
60 | * Called with dcache_lock and dentry->d_lock held. | ||
61 | */ | 64 | */ |
62 | static inline void fsnotify_d_move(struct dentry *dentry) | 65 | static inline void fsnotify_d_move(struct dentry *dentry) |
63 | { | 66 | { |
@@ -93,8 +96,8 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, | |||
93 | old_dir_mask |= FS_DN_RENAME; | 96 | old_dir_mask |= FS_DN_RENAME; |
94 | 97 | ||
95 | if (isdir) { | 98 | if (isdir) { |
96 | old_dir_mask |= FS_IN_ISDIR; | 99 | old_dir_mask |= FS_ISDIR; |
97 | new_dir_mask |= FS_IN_ISDIR; | 100 | new_dir_mask |= FS_ISDIR; |
98 | } | 101 | } |
99 | 102 | ||
100 | fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie); | 103 | fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie); |
@@ -132,7 +135,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) | |||
132 | __u32 mask = FS_DELETE; | 135 | __u32 mask = FS_DELETE; |
133 | 136 | ||
134 | if (isdir) | 137 | if (isdir) |
135 | mask |= FS_IN_ISDIR; | 138 | mask |= FS_ISDIR; |
136 | 139 | ||
137 | fsnotify_parent(NULL, dentry, mask); | 140 | fsnotify_parent(NULL, dentry, mask); |
138 | } | 141 | } |
@@ -174,7 +177,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct | |||
174 | */ | 177 | */ |
175 | static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) | 178 | static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) |
176 | { | 179 | { |
177 | __u32 mask = (FS_CREATE | FS_IN_ISDIR); | 180 | __u32 mask = (FS_CREATE | FS_ISDIR); |
178 | struct inode *d_inode = dentry->d_inode; | 181 | struct inode *d_inode = dentry->d_inode; |
179 | 182 | ||
180 | audit_inode_child(dentry, inode); | 183 | audit_inode_child(dentry, inode); |
@@ -192,7 +195,7 @@ static inline void fsnotify_access(struct file *file) | |||
192 | __u32 mask = FS_ACCESS; | 195 | __u32 mask = FS_ACCESS; |
193 | 196 | ||
194 | if (S_ISDIR(inode->i_mode)) | 197 | if (S_ISDIR(inode->i_mode)) |
195 | mask |= FS_IN_ISDIR; | 198 | mask |= FS_ISDIR; |
196 | 199 | ||
197 | if (!(file->f_mode & FMODE_NONOTIFY)) { | 200 | if (!(file->f_mode & FMODE_NONOTIFY)) { |
198 | fsnotify_parent(path, NULL, mask); | 201 | fsnotify_parent(path, NULL, mask); |
@@ -210,7 +213,7 @@ static inline void fsnotify_modify(struct file *file) | |||
210 | __u32 mask = FS_MODIFY; | 213 | __u32 mask = FS_MODIFY; |
211 | 214 | ||
212 | if (S_ISDIR(inode->i_mode)) | 215 | if (S_ISDIR(inode->i_mode)) |
213 | mask |= FS_IN_ISDIR; | 216 | mask |= FS_ISDIR; |
214 | 217 | ||
215 | if (!(file->f_mode & FMODE_NONOTIFY)) { | 218 | if (!(file->f_mode & FMODE_NONOTIFY)) { |
216 | fsnotify_parent(path, NULL, mask); | 219 | fsnotify_parent(path, NULL, mask); |
@@ -228,12 +231,10 @@ static inline void fsnotify_open(struct file *file) | |||
228 | __u32 mask = FS_OPEN; | 231 | __u32 mask = FS_OPEN; |
229 | 232 | ||
230 | if (S_ISDIR(inode->i_mode)) | 233 | if (S_ISDIR(inode->i_mode)) |
231 | mask |= FS_IN_ISDIR; | 234 | mask |= FS_ISDIR; |
232 | 235 | ||
233 | if (!(file->f_mode & FMODE_NONOTIFY)) { | 236 | fsnotify_parent(path, NULL, mask); |
234 | fsnotify_parent(path, NULL, mask); | 237 | fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0); |
235 | fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0); | ||
236 | } | ||
237 | } | 238 | } |
238 | 239 | ||
239 | /* | 240 | /* |
@@ -247,7 +248,7 @@ static inline void fsnotify_close(struct file *file) | |||
247 | __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; | 248 | __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; |
248 | 249 | ||
249 | if (S_ISDIR(inode->i_mode)) | 250 | if (S_ISDIR(inode->i_mode)) |
250 | mask |= FS_IN_ISDIR; | 251 | mask |= FS_ISDIR; |
251 | 252 | ||
252 | if (!(file->f_mode & FMODE_NONOTIFY)) { | 253 | if (!(file->f_mode & FMODE_NONOTIFY)) { |
253 | fsnotify_parent(path, NULL, mask); | 254 | fsnotify_parent(path, NULL, mask); |
@@ -264,7 +265,7 @@ static inline void fsnotify_xattr(struct dentry *dentry) | |||
264 | __u32 mask = FS_ATTRIB; | 265 | __u32 mask = FS_ATTRIB; |
265 | 266 | ||
266 | if (S_ISDIR(inode->i_mode)) | 267 | if (S_ISDIR(inode->i_mode)) |
267 | mask |= FS_IN_ISDIR; | 268 | mask |= FS_ISDIR; |
268 | 269 | ||
269 | fsnotify_parent(NULL, dentry, mask); | 270 | fsnotify_parent(NULL, dentry, mask); |
270 | fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); | 271 | fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); |
@@ -299,7 +300,7 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) | |||
299 | 300 | ||
300 | if (mask) { | 301 | if (mask) { |
301 | if (S_ISDIR(inode->i_mode)) | 302 | if (S_ISDIR(inode->i_mode)) |
302 | mask |= FS_IN_ISDIR; | 303 | mask |= FS_ISDIR; |
303 | 304 | ||
304 | fsnotify_parent(NULL, dentry, mask); | 305 | fsnotify_parent(NULL, dentry, mask); |
305 | fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); | 306 | fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); |