/* Called when a group is being torn down to clean up any outstanding event notifications.  */
void fsnotify_flush_notify(struct fsnotify_group *group)
/* Called when a group is being torn down to clean up any outstanding event notifications.  */
void fsnotify_flush_notify(struct fsnotify_group *group)
{
	struct fsnotify_event *event;
	struct fsnotify_event_private_data *priv;
	mutex_lock(&group->notification_mutex);
	while (!fsnotify_notify_queue_is_empty(group)) {
		event = fsnotify_remove_notify_event(group);
		if (group->ops->free_event_priv) {
			spin_lock(&event->lock);
			priv = fsnotify_remove_priv_from_event(group, event);
			spin_unlock(&event->lock);
			if (priv)
				group->ops->free_event_priv(priv);
		}
		fsnotify_put_event(event);
	}
	mutex_unlock(&group->notification_mutex);
}