summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2009-12-17 21:24:23 -0500
committerEric Paris <eparis@redhat.com>2010-07-28 09:58:51 -0400
commit36fddebaa8a9186d4f5817ab798a83400b2fb2e7 (patch)
tree5fea41060cada4826677c12b7d4afa747841b124 /fs
parent19c2a0e1a2f60112c158342ba5f568f72b741c2c (diff)
downloadlinux-36fddebaa8a9186d4f5817ab798a83400b2fb2e7.tar.bz2
fsnotify: initialize the group->num_marks in a better place
Currently the comments say that group->num_marks is held because the group is on the fsnotify_group list. This isn't strictly the case, we really just hold the num_marks for the life of the group (any time group->refcnt is != 0) This patch moves the initialization stuff and makes it clear when it is really being held. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/notify/group.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/notify/group.c b/fs/notify/group.c
index c80809745312..656c534ffb66 100644
--- a/fs/notify/group.c
+++ b/fs/notify/group.c
@@ -82,9 +82,6 @@ static void fsnotify_add_group(struct fsnotify_group *group)
BUG_ON(!mutex_is_locked(&fsnotify_grp_mutex));
group->on_inode_group_list = 1;
- /* being on the fsnotify_groups list holds one num_marks */
- atomic_inc(&group->num_marks);
-
list_add_tail_rcu(&group->inode_group_list, &fsnotify_inode_groups);
}
@@ -183,7 +180,14 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops)
if (!group)
return ERR_PTR(-ENOMEM);
+ /* set to 0 when there a no external references to this group */
atomic_set(&group->refcnt, 1);
+ /*
+ * hits 0 when there are no external references AND no marks for
+ * this group
+ */
+ atomic_set(&group->num_marks, 1);
+
mutex_init(&group->notification_mutex);
INIT_LIST_HEAD(&group->notification_list);