aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify/inode_mark.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/inode_mark.c
parentef5e2b785fb3216269e6d0656d38ec286b98dbe5 (diff)
downloadkernel_samsung_smdk4412-35566087099c3ff8901d65ee98af56347ee66e5a.zip
kernel_samsung_smdk4412-35566087099c3ff8901d65ee98af56347ee66e5a.tar.gz
kernel_samsung_smdk4412-35566087099c3ff8901d65ee98af56347ee66e5a.tar.bz2
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.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c
index 27c1b43..ba6f983 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)
}
}
-/*
- * given a group and inode, find the mark associated with that combination.
- * if found take a reference to that mark and return it, else return NULL
- */
-struct fsnotify_mark *fsnotify_find_mark(struct fsnotify_group *group,
- struct inode *inode)
+static struct fsnotify_mark *fsnotify_find_mark_locked(struct fsnotify_group *group,
+ struct inode *inode)
{
struct fsnotify_mark *mark;
struct hlist_node *pos;
@@ -282,6 +278,22 @@ struct fsnotify_mark *fsnotify_find_mark(struct fsnotify_group *group,
return NULL;
}
+/*
+ * given a group and inode, find the mark associated with that combination.
+ * if found take a reference to that mark and return it, else return NULL
+ */
+struct fsnotify_mark *fsnotify_find_mark(struct fsnotify_group *group,
+ struct inode *inode)
+{
+ struct fsnotify_mark *mark;
+
+ spin_lock(&inode->i_lock);
+ mark = fsnotify_find_mark_locked(group, inode);
+ spin_unlock(&inode->i_lock);
+
+ return mark;
+}
+
void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old)
{
assert_spin_locked(&old->lock);
@@ -349,7 +361,7 @@ int fsnotify_add_mark(struct fsnotify_mark *mark,
spin_lock(&inode->i_lock);
if (!allow_dups)
- lmark = fsnotify_find_mark(group, inode);
+ lmark = fsnotify_find_mark_locked(group, inode);
if (!lmark) {
mark->group = group;
mark->i.inode = inode;