From: Eric Paris <eparis@redhat.com>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: agruen@suse.de
Subject: [PATCH 4/5] fsnotify: initialize the group->num_marks in a better place
Date: Sun, 25 Oct 2009 16:27:14 -0400 [thread overview]
Message-ID: <20091025202713.11501.31399.stgit@paris.rdu.redhat.com> (raw)
In-Reply-To: <20091025202655.11501.70437.stgit@paris.rdu.redhat.com>
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>
---
fs/notify/group.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/fs/notify/group.c b/fs/notify/group.c
index 73d2c30..f8c2f0f 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);
}
@@ -184,7 +181,14 @@ struct fsnotify_group *fsnotify_alloc_group(__u32 mask,
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);
+
group->mask = mask;
next prev parent reply other threads:[~2009-10-25 20:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-25 20:26 [PATCH 1/5] fsnotify: fsnotify_obtain_group kzalloc cleanup Eric Paris
2009-10-25 20:27 ` [PATCH 2/5] fsnotify: fsnotify_obtain_group should be fsnotify_alloc_group Eric Paris
2009-10-25 20:27 ` [PATCH 3/5] fsnotify: rename fsnotify_groups to fsnotify_inode_groups Eric Paris
2009-10-25 20:27 ` Eric Paris [this message]
2009-10-25 20:27 ` [PATCH 5/5] fsnotify: add groups to fsnotify_inode_groups when registering inode watch Eric Paris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091025202713.11501.31399.stgit@paris.rdu.redhat.com \
--to=eparis@redhat.com \
--cc=agruen@suse.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).