|
|
@@ -73,7 +73,8 @@ void fsnotify_destroy_event(struct fsnotify_group *group,
|
|
|
/* Overflow events are per-group and we don't want to free them */
|
|
|
if (!event || event->mask == FS_Q_OVERFLOW)
|
|
|
return;
|
|
|
-
|
|
|
+ /* If the event is still queued, we have a problem... */
|
|
|
+ WARN_ON(!list_empty(&event->list));
|
|
|
group->ops->free_event(event);
|
|
|
}
|
|
|
|
|
|
@@ -124,6 +125,21 @@ int fsnotify_add_event(struct fsnotify_group *group,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * Remove @event from group's notification queue. It is the responsibility of
|
|
|
+ * the caller to destroy the event.
|
|
|
+ */
|
|
|
+void fsnotify_remove_event(struct fsnotify_group *group,
|
|
|
+ struct fsnotify_event *event)
|
|
|
+{
|
|
|
+ mutex_lock(&group->notification_mutex);
|
|
|
+ if (!list_empty(&event->list)) {
|
|
|
+ list_del_init(&event->list);
|
|
|
+ group->q_len--;
|
|
|
+ }
|
|
|
+ mutex_unlock(&group->notification_mutex);
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* Remove and return the first event from the notification list. It is the
|
|
|
* responsibility of the caller to destroy the obtained event
|