Patchwork [02/10] fsnotify: introduce fsnotify_get_group()

login
register
mail settings
Submitter Andy Whitcroft
Date April 16, 2012, 6:02 p.m.
Message ID <1334599360-15346-3-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/152955/
State New
Headers show

Comments

Andy Whitcroft - April 16, 2012, 6:02 p.m.
From: Lino Sanfilippo <LinoSanfilippo@gmx.de>

Introduce fsnotify_get_group() which increments the reference counter of a group.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Signed-off-by: Eric Paris <eparis@redhat.com>

(cherry-picked from commit 159fbe33a7c7c9ecee7a131c5b1d28319b2108c0 git://git.infradead.org/users/eparis/notify.git)
BugLink: http://bugs.launchpad.net/bugs/922906
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 fs/notify/group.c                |    8 ++++++++
 include/linux/fsnotify_backend.h |    4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

Patch

diff --git a/fs/notify/group.c b/fs/notify/group.c
index c49e729..59a6b53 100644
--- a/fs/notify/group.c
+++ b/fs/notify/group.c
@@ -64,6 +64,14 @@  void fsnotify_destroy_group(struct fsnotify_group *group)
 }
 
 /*
+ * Get reference to a group.
+ */
+void fsnotify_get_group(struct fsnotify_group *group)
+{
+	atomic_inc(&group->refcnt);
+}
+
+/*
  * Drop a reference to a group.  Free it if it's through.
  */
 void fsnotify_put_group(struct fsnotify_group *group)
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index afac095..a1450b3 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -360,8 +360,10 @@  static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode
 
 /* called from fsnotify listeners, such as fanotify or dnotify */
 
-/* get a reference to an existing or create a new group */
+/* create a new group */
 extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops);
+/* get reference to a group */
+extern void fsnotify_get_group(struct fsnotify_group *group);
 /* drop reference on a group from fsnotify_alloc_group */
 extern void fsnotify_put_group(struct fsnotify_group *group);
 /* destroy group */