diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2009-12-17 21:24:25 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 09:58:54 -0400 |
commit | 35566087099c3ff8901d65ee98af56347ee66e5a (patch) | |
tree | e4e56bcf787e5f100fa1ea0138c417e1203b10ae /fs/notify/inode_mark.c | |
parent | ef5e2b785fb3216269e6d0656d38ec286b98dbe5 (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/inode_mark.c')
-rw-r--r-- | fs/notify/inode_mark.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c index 27c1b43ad739..ba6f9833561b 100644 --- a/fs/notify/inode_mark.c +++ b/fs/notify/inode_mark.c | |||
@@ -261,12 +261,8 @@ void fsnotify_clear_marks_by_inode(struct inode *inode) | |||
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | /* | 264 | static struct fsnotify_mark *fsnotify_find_mark_locked(struct fsnotify_group *group, |
265 | * given a group and inode, find the mark associated with that combination. | 265 | struct inode *inode) |
266 | * if found take a reference to that mark and return it, else return NULL | ||
267 | */ | ||
268 | struct fsnotify_mark *fsnotify_find_mark(struct fsnotify_group *group, | ||
269 | struct inode *inode) | ||
270 | { | 266 | { |
271 | struct fsnotify_mark *mark; | 267 | struct fsnotify_mark *mark; |
272 | struct hlist_node *pos; | 268 | struct hlist_node *pos; |
@@ -282,6 +278,22 @@ struct fsnotify_mark *fsnotify_find_mark(struct fsnotify_group *group, | |||
282 | return NULL; | 278 | return NULL; |
283 | } | 279 | } |
284 | 280 | ||
281 | /* | ||
282 | * given a group and inode, find the mark associated with that combination. | ||
283 | * if found take a reference to that mark and return it, else return NULL | ||
284 | */ | ||
285 | struct fsnotify_mark *fsnotify_find_mark(struct fsnotify_group *group, | ||
286 | struct inode *inode) | ||
287 | { | ||
288 | struct fsnotify_mark *mark; | ||
289 | |||
290 | spin_lock(&inode->i_lock); | ||
291 | mark = fsnotify_find_mark_locked(group, inode); | ||
292 | spin_unlock(&inode->i_lock); | ||
293 | |||
294 | return mark; | ||
295 | } | ||
296 | |||
285 | void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old) | 297 | void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old) |
286 | { | 298 | { |
287 | assert_spin_locked(&old->lock); | 299 | assert_spin_locked(&old->lock); |
@@ -349,7 +361,7 @@ int fsnotify_add_mark(struct fsnotify_mark *mark, | |||
349 | spin_lock(&inode->i_lock); | 361 | spin_lock(&inode->i_lock); |
350 | 362 | ||
351 | if (!allow_dups) | 363 | if (!allow_dups) |
352 | lmark = fsnotify_find_mark(group, inode); | 364 | lmark = fsnotify_find_mark_locked(group, inode); |
353 | if (!lmark) { | 365 | if (!lmark) { |
354 | mark->group = group; | 366 | mark->group = group; |
355 | mark->i.inode = inode; | 367 | mark->i.inode = inode; |