summaryrefslogtreecommitdiff
path: root/fs/notify/group.c
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2016-10-10 12:43:03 -0700
committerDmitry Shmidt <dimitrysh@google.com>2016-10-10 12:43:03 -0700
commit09f6247a9ccaffcc9af1e4a9038e14ecdb76a79d (patch)
treef28f9f114c1aab70185f424ec2be689d1e6cbd3b /fs/notify/group.c
parent8760f8e3d9806a940d759c9e12fff7eb7130b9ab (diff)
parentd19e48fe5da7b83d02ed4aec3567f08ae02a168c (diff)
Merge tag 'v4.4.23' into android-4.4.y
This is the 4.4.23 stable release
Diffstat (limited to 'fs/notify/group.c')
-rw-r--r--fs/notify/group.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/notify/group.c b/fs/notify/group.c
index d16b62cb2854..18eb30c6bd8f 100644
--- a/fs/notify/group.c
+++ b/fs/notify/group.c
@@ -40,6 +40,17 @@ static void fsnotify_final_destroy_group(struct fsnotify_group *group)
}
/*
+ * Stop queueing new events for this group. Once this function returns
+ * fsnotify_add_event() will not add any new events to the group's queue.
+ */
+void fsnotify_group_stop_queueing(struct fsnotify_group *group)
+{
+ mutex_lock(&group->notification_mutex);
+ group->shutdown = true;
+ mutex_unlock(&group->notification_mutex);
+}
+
+/*
* Trying to get rid of a group. Remove all marks, flush all events and release
* the group reference.
* Note that another thread calling fsnotify_clear_marks_by_group() may still
@@ -47,6 +58,14 @@ static void fsnotify_final_destroy_group(struct fsnotify_group *group)
*/
void fsnotify_destroy_group(struct fsnotify_group *group)
{
+ /*
+ * Stop queueing new events. The code below is careful enough to not
+ * require this but fanotify needs to stop queuing events even before
+ * fsnotify_destroy_group() is called and this makes the other callers
+ * of fsnotify_destroy_group() to see the same behavior.
+ */
+ fsnotify_group_stop_queueing(group);
+
/* clear all inode marks for this group */
fsnotify_clear_marks_by_group(group);