aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify/dnotify/dnotify.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2009-12-17 21:24:25 -0500
committerEric Paris <eparis@redhat.com>2010-07-28 09:58:54 -0400
commit35566087099c3ff8901d65ee98af56347ee66e5a (patch)
treee4e56bcf787e5f100fa1ea0138c417e1203b10ae /fs/notify/dnotify/dnotify.c
parentef5e2b785fb3216269e6d0656d38ec286b98dbe5 (diff)
fsnotify: take inode->i_lock inside fsnotify_find_mark_entry()
All callers to fsnotify_find_mark_entry() except one take and release inode->i_lock around the call. Take the lock inside fsnotify_find_mark_entry() instead. Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify/dnotify/dnotify.c')
-rw-r--r--fs/notify/dnotify/dnotify.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index 3efb8b9a572d..cac2eb896639 100644
--- a/fs/notify/dnotify/dnotify.c
+++ b/fs/notify/dnotify/dnotify.c
@@ -95,11 +95,7 @@ static int dnotify_handle_event(struct fsnotify_group *group,
95 95
96 to_tell = event->to_tell; 96 to_tell = event->to_tell;
97 97
98 spin_lock(&to_tell->i_lock);
99 fsn_mark = fsnotify_find_mark(group, to_tell); 98 fsn_mark = fsnotify_find_mark(group, to_tell);
100 spin_unlock(&to_tell->i_lock);
101
102 /* unlikely since we alreay passed dnotify_should_send_event() */
103 if (unlikely(!fsn_mark)) 99 if (unlikely(!fsn_mark))
104 return 0; 100 return 0;
105 dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark); 101 dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);
@@ -147,11 +143,7 @@ static bool dnotify_should_send_event(struct fsnotify_group *group,
147 if (!S_ISDIR(inode->i_mode)) 143 if (!S_ISDIR(inode->i_mode))
148 return false; 144 return false;
149 145
150 spin_lock(&inode->i_lock);
151 fsn_mark = fsnotify_find_mark(group, inode); 146 fsn_mark = fsnotify_find_mark(group, inode);
152 spin_unlock(&inode->i_lock);
153
154 /* no mark means no dnotify watch */
155 if (!fsn_mark) 147 if (!fsn_mark)
156 return false; 148 return false;
157 149
@@ -201,9 +193,7 @@ void dnotify_flush(struct file *filp, fl_owner_t id)
201 if (!S_ISDIR(inode->i_mode)) 193 if (!S_ISDIR(inode->i_mode))
202 return; 194 return;
203 195
204 spin_lock(&inode->i_lock);
205 fsn_mark = fsnotify_find_mark(dnotify_group, inode); 196 fsn_mark = fsnotify_find_mark(dnotify_group, inode);
206 spin_unlock(&inode->i_lock);
207 if (!fsn_mark) 197 if (!fsn_mark)
208 return; 198 return;
209 dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark); 199 dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);
@@ -356,9 +346,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
356 mutex_lock(&dnotify_mark_mutex); 346 mutex_lock(&dnotify_mark_mutex);
357 347
358 /* add the new_fsn_mark or find an old one. */ 348 /* add the new_fsn_mark or find an old one. */
359 spin_lock(&inode->i_lock);
360 fsn_mark = fsnotify_find_mark(dnotify_group, inode); 349 fsn_mark = fsnotify_find_mark(dnotify_group, inode);
361 spin_unlock(&inode->i_lock);
362 if (fsn_mark) { 350 if (fsn_mark) {
363 dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark); 351 dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);
364 spin_lock(&fsn_mark->lock); 352 spin_lock(&fsn_mark->lock);