@@ -183,8 +183,10 @@ static bool fsnotify_event_needs_parent(struct inode *inode, __u32 mnt_mask,
183
183
BUILD_BUG_ON (FS_EVENTS_POSS_ON_CHILD & ~FS_EVENTS_POSS_TO_PARENT );
184
184
185
185
/* Did either inode/sb/mount subscribe for events with parent/name? */
186
- marks_mask |= fsnotify_parent_needed_mask (inode -> i_fsnotify_mask );
187
- marks_mask |= fsnotify_parent_needed_mask (inode -> i_sb -> s_fsnotify_mask );
186
+ marks_mask |= fsnotify_parent_needed_mask (
187
+ READ_ONCE (inode -> i_fsnotify_mask ));
188
+ marks_mask |= fsnotify_parent_needed_mask (
189
+ READ_ONCE (inode -> i_sb -> s_fsnotify_mask ));
188
190
marks_mask |= fsnotify_parent_needed_mask (mnt_mask );
189
191
190
192
/* Did they subscribe for this event with parent/name info? */
@@ -195,8 +197,8 @@ static bool fsnotify_event_needs_parent(struct inode *inode, __u32 mnt_mask,
195
197
static inline bool fsnotify_object_watched (struct inode * inode , __u32 mnt_mask ,
196
198
__u32 mask )
197
199
{
198
- __u32 marks_mask = inode -> i_fsnotify_mask | mnt_mask |
199
- inode -> i_sb -> s_fsnotify_mask ;
200
+ __u32 marks_mask = READ_ONCE ( inode -> i_fsnotify_mask ) | mnt_mask |
201
+ READ_ONCE ( inode -> i_sb -> s_fsnotify_mask ) ;
200
202
201
203
return mask & marks_mask & ALL_FSNOTIFY_EVENTS ;
202
204
}
@@ -213,7 +215,8 @@ int __fsnotify_parent(struct dentry *dentry, __u32 mask, const void *data,
213
215
int data_type )
214
216
{
215
217
const struct path * path = fsnotify_data_path (data , data_type );
216
- __u32 mnt_mask = path ? real_mount (path -> mnt )-> mnt_fsnotify_mask : 0 ;
218
+ __u32 mnt_mask = path ?
219
+ READ_ONCE (real_mount (path -> mnt )-> mnt_fsnotify_mask ) : 0 ;
217
220
struct inode * inode = d_inode (dentry );
218
221
struct dentry * parent ;
219
222
bool parent_watched = dentry -> d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED ;
@@ -557,13 +560,13 @@ int fsnotify(__u32 mask, const void *data, int data_type, struct inode *dir,
557
560
(!inode2 || !inode2 -> i_fsnotify_marks ))
558
561
return 0 ;
559
562
560
- marks_mask = sb -> s_fsnotify_mask ;
563
+ marks_mask = READ_ONCE ( sb -> s_fsnotify_mask ) ;
561
564
if (mnt )
562
- marks_mask |= mnt -> mnt_fsnotify_mask ;
565
+ marks_mask |= READ_ONCE ( mnt -> mnt_fsnotify_mask ) ;
563
566
if (inode )
564
- marks_mask |= inode -> i_fsnotify_mask ;
567
+ marks_mask |= READ_ONCE ( inode -> i_fsnotify_mask ) ;
565
568
if (inode2 )
566
- marks_mask |= inode2 -> i_fsnotify_mask ;
569
+ marks_mask |= READ_ONCE ( inode2 -> i_fsnotify_mask ) ;
567
570
568
571
569
572
/*
0 commit comments