From: Jérémie Galarneau Date: Fri, 6 Jul 2018 05:01:48 +0000 (-0400) Subject: fd-tracker: perform unsuspendable_fd release through call_rcu X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=commitdiff_plain;h=89b4e38cf343e8e9ecde498e0b5530478dae6c3b fd-tracker: perform unsuspendable_fd release through call_rcu Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/fd-tracker/fd-tracker.c b/src/common/fd-tracker/fd-tracker.c index 3720e075c..580f20a00 100644 --- a/src/common/fd-tracker/fd-tracker.c +++ b/src/common/fd-tracker/fd-tracker.c @@ -129,6 +129,7 @@ struct unsuspendable_fd { int fd; char *name; struct cds_lfht_node tracker_node; + struct rcu_head rcu_head; }; static struct { @@ -169,14 +170,23 @@ int match_fd(struct cds_lfht_node *node, const void *key) (void *) key); } +static +void delete_unsuspendable_fd(struct rcu_head *head) +{ + struct unsuspendable_fd *fd = caa_container_of(head, + struct unsuspendable_fd, rcu_head); + + free(fd->name); + free(fd); +} + static void unsuspendable_fd_destroy(struct unsuspendable_fd *entry) { if (!entry) { return; } - free(entry->name); - free(entry); + call_rcu(&entry->rcu_head, delete_unsuspendable_fd); } static