aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify/notification.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/notify/notification.c')
-rw-r--r--fs/notify/notification.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/fs/notify/notification.c b/fs/notify/notification.c
index a95d8e037aeb..e455e83ceeeb 100644
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@ -82,7 +82,8 @@ void fsnotify_destroy_event(struct fsnotify_group *group,
82 * Add an event to the group notification queue. The group can later pull this 82 * Add an event to the group notification queue. The group can later pull this
83 * event off the queue to deal with. The function returns 0 if the event was 83 * event off the queue to deal with. The function returns 0 if the event was
84 * added to the queue, 1 if the event was merged with some other queued event, 84 * added to the queue, 1 if the event was merged with some other queued event,
85 * 2 if the queue of events has overflown. 85 * 2 if the event was not queued - either the queue of events has overflown
86 * or the group is shutting down.
86 */ 87 */
87int fsnotify_add_event(struct fsnotify_group *group, 88int fsnotify_add_event(struct fsnotify_group *group,
88 struct fsnotify_event *event, 89 struct fsnotify_event *event,
@@ -96,6 +97,11 @@ int fsnotify_add_event(struct fsnotify_group *group,
96 97
97 mutex_lock(&group->notification_mutex); 98 mutex_lock(&group->notification_mutex);
98 99
100 if (group->shutdown) {
101 mutex_unlock(&group->notification_mutex);
102 return 2;
103 }
104
99 if (group->q_len >= group->max_events) { 105 if (group->q_len >= group->max_events) {
100 ret = 2; 106 ret = 2;
101 /* Queue overflow event only if it isn't already queued */ 107 /* Queue overflow event only if it isn't already queued */
@@ -126,21 +132,6 @@ queue:
126} 132}
127 133
128/* 134/*
129 * Remove @event from group's notification queue. It is the responsibility of
130 * the caller to destroy the event.
131 */
132void fsnotify_remove_event(struct fsnotify_group *group,
133 struct fsnotify_event *event)
134{
135 mutex_lock(&group->notification_mutex);
136 if (!list_empty(&event->list)) {
137 list_del_init(&event->list);
138 group->q_len--;
139 }
140 mutex_unlock(&group->notification_mutex);
141}
142
143/*
144 * Remove and return the first event from the notification list. It is the 135 * Remove and return the first event from the notification list. It is the
145 * responsibility of the caller to destroy the obtained event 136 * responsibility of the caller to destroy the obtained event
146 */ 137 */