Commit 330ae77d authored by Gabriel Krisman Bertazi's avatar Gabriel Krisman Bertazi Committed by Jan Kara
Browse files

fsnotify: Pass group argument to free_event

For group-wide mempool backed events, like FS_ERROR, the free_event
callback will need to reference the group's mempool to free the memory.
Wire that argument into the current callers.

Link: https://lore.kernel.org/r/20211025192746.66445-13-krisman@collabora.com


Reviewed-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarGabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 24dca905
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -835,7 +835,8 @@ static void fanotify_free_name_event(struct fanotify_event *event)
	kfree(FANOTIFY_NE(event));
}

static void fanotify_free_event(struct fsnotify_event *fsn_event)
static void fanotify_free_event(struct fsnotify_group *group,
				struct fsnotify_event *fsn_event)
{
	struct fanotify_event *event;

+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ void fsnotify_destroy_group(struct fsnotify_group *group)
	 * that deliberately ignores overflow events.
	 */
	if (group->overflow_event)
		group->ops->free_event(group->overflow_event);
		group->ops->free_event(group, group->overflow_event);

	fsnotify_put_group(group);
}
+2 −1
Original line number Diff line number Diff line
@@ -177,7 +177,8 @@ static void inotify_free_group_priv(struct fsnotify_group *group)
		dec_inotify_instances(group->inotify_data.ucounts);
}

static void inotify_free_event(struct fsnotify_event *fsn_event)
static void inotify_free_event(struct fsnotify_group *group,
			       struct fsnotify_event *fsn_event)
{
	kfree(INOTIFY_E(fsn_event));
}
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ void fsnotify_destroy_event(struct fsnotify_group *group,
		WARN_ON(!list_empty(&event->list));
		spin_unlock(&group->notification_lock);
	}
	group->ops->free_event(event);
	group->ops->free_event(group, event);
}

/*
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ struct fsnotify_ops {
			    const struct qstr *file_name, u32 cookie);
	void (*free_group_priv)(struct fsnotify_group *group);
	void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group);
	void (*free_event)(struct fsnotify_event *event);
	void (*free_event)(struct fsnotify_group *group, struct fsnotify_event *event);
	/* called on final put+free to free memory */
	void (*free_mark)(struct fsnotify_mark *mark);
};