fd-tracker: perform unsuspendable_fd release through call_rcu
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 6 Jul 2018 05:01:48 +0000 (01:01 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 21 Sep 2018 04:00:52 +0000 (00:00 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/fd-tracker/fd-tracker.c

index 3720e075cba9ef7e6a4dc56cf92b23f6e8dafa72..580f20a007d420d1c3bc7d69643d616b79dba467 100644 (file)
@@ -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
This page took 0.027163 seconds and 5 git commands to generate.