2323static inline void fsnotify_d_instantiate (struct dentry * entry ,
2424 struct inode * inode )
2525{
26+ __fsnotify_d_instantiate (entry , inode );
27+
2628 inotify_d_instantiate (entry , inode );
2729}
2830
31+ /* Notify this dentry's parent about a child's events. */
32+ static inline void fsnotify_parent (struct dentry * dentry , __u32 mask )
33+ {
34+ __fsnotify_parent (dentry , mask );
35+
36+ inotify_dentry_parent_queue_event (dentry , mask , 0 , dentry -> d_name .name );
37+ }
38+
2939/*
3040 * fsnotify_d_move - entry has been moved
3141 * Called with dcache_lock and entry->d_lock held.
3242 */
3343static inline void fsnotify_d_move (struct dentry * entry )
3444{
45+ /*
46+ * On move we need to update entry->d_flags to indicate if the new parent
47+ * cares about events from this entry.
48+ */
49+ __fsnotify_update_dcache_flags (entry );
50+
3551 inotify_d_move (entry );
3652}
3753
@@ -117,7 +133,8 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
117133 if (isdir )
118134 mask |= FS_IN_ISDIR ;
119135 dnotify_parent (dentry , DN_DELETE );
120- inotify_dentry_parent_queue_event (dentry , mask , 0 , dentry -> d_name .name );
136+
137+ fsnotify_parent (dentry , mask );
121138}
122139
123140/*
@@ -188,9 +205,9 @@ static inline void fsnotify_access(struct dentry *dentry)
188205 mask |= FS_IN_ISDIR ;
189206
190207 dnotify_parent (dentry , DN_ACCESS );
191- inotify_dentry_parent_queue_event (dentry , mask , 0 , dentry -> d_name .name );
192208 inotify_inode_queue_event (inode , mask , 0 , NULL , NULL );
193209
210+ fsnotify_parent (dentry , mask );
194211 fsnotify (inode , mask , inode , FSNOTIFY_EVENT_INODE );
195212}
196213
@@ -206,9 +223,9 @@ static inline void fsnotify_modify(struct dentry *dentry)
206223 mask |= FS_IN_ISDIR ;
207224
208225 dnotify_parent (dentry , DN_MODIFY );
209- inotify_dentry_parent_queue_event (dentry , mask , 0 , dentry -> d_name .name );
210226 inotify_inode_queue_event (inode , mask , 0 , NULL , NULL );
211227
228+ fsnotify_parent (dentry , mask );
212229 fsnotify (inode , mask , inode , FSNOTIFY_EVENT_INODE );
213230}
214231
@@ -223,9 +240,9 @@ static inline void fsnotify_open(struct dentry *dentry)
223240 if (S_ISDIR (inode -> i_mode ))
224241 mask |= FS_IN_ISDIR ;
225242
226- inotify_dentry_parent_queue_event (dentry , mask , 0 , dentry -> d_name .name );
227243 inotify_inode_queue_event (inode , mask , 0 , NULL , NULL );
228244
245+ fsnotify_parent (dentry , mask );
229246 fsnotify (inode , mask , inode , FSNOTIFY_EVENT_INODE );
230247}
231248
@@ -236,16 +253,15 @@ static inline void fsnotify_close(struct file *file)
236253{
237254 struct dentry * dentry = file -> f_path .dentry ;
238255 struct inode * inode = dentry -> d_inode ;
239- const char * name = dentry -> d_name .name ;
240256 fmode_t mode = file -> f_mode ;
241257 __u32 mask = (mode & FMODE_WRITE ) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE ;
242258
243259 if (S_ISDIR (inode -> i_mode ))
244260 mask |= FS_IN_ISDIR ;
245261
246- inotify_dentry_parent_queue_event (dentry , mask , 0 , name );
247262 inotify_inode_queue_event (inode , mask , 0 , NULL , NULL );
248263
264+ fsnotify_parent (dentry , mask );
249265 fsnotify (inode , mask , file , FSNOTIFY_EVENT_FILE );
250266}
251267
@@ -260,9 +276,9 @@ static inline void fsnotify_xattr(struct dentry *dentry)
260276 if (S_ISDIR (inode -> i_mode ))
261277 mask |= FS_IN_ISDIR ;
262278
263- inotify_dentry_parent_queue_event (dentry , mask , 0 , dentry -> d_name .name );
264279 inotify_inode_queue_event (inode , mask , 0 , NULL , NULL );
265280
281+ fsnotify_parent (dentry , mask );
266282 fsnotify (inode , mask , inode , FSNOTIFY_EVENT_INODE );
267283}
268284
@@ -311,8 +327,8 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
311327 if (S_ISDIR (inode -> i_mode ))
312328 in_mask |= FS_IN_ISDIR ;
313329 inotify_inode_queue_event (inode , in_mask , 0 , NULL , NULL );
314- inotify_dentry_parent_queue_event ( dentry , in_mask , 0 ,
315- dentry -> d_name . name );
330+
331+ fsnotify_parent ( dentry , in_mask );
316332 fsnotify (inode , in_mask , inode , FSNOTIFY_EVENT_INODE );
317333 }
318334}
0 commit comments