[systemd-devel] FW: [PATCH] names: clear e->activator when activator has disconnected

Daniel Mack daniel at zonque.org
Mon Feb 24 01:16:54 PST 2014

On 02/24/2014 09:39 AM, Radoslaw Pajak wrote:
> If e->activator wasn't released when activator connection has disconnected,
> there was no possibility to open new activator connection for that name
> in the case when there was another owner of that name.

Interesting. Like in the last patch you sent, you seem to have
situations where the activator comes and goes just like a normal
connection. Which should be handled fine by kdbus, it's just different
from our use case.

> @@ -255,6 +255,8 @@ void kdbus_name_remove_by_conn(struct
> kdbus_name_registry *reg,
>  		kdbus_name_queue_item_free(q);
>  	list_for_each_entry_safe(e, e_tmp, &names_list, conn_entry)
>  		kdbus_name_entry_release(e, &notify_list);
> +	if (conn->flags & KDBUS_HELLO_ACTIVATOR)
> +		conn->activator_of->activator = kdbus_conn_unref(conn);
>  	mutex_unlock(&reg->entries_lock);
>  	mutex_unlock(&conn->bus->lock);

Hmm, we have the information if the connection that is disconnecting is
the activator of a name entry. So why don't just use that as condition
instead of introducing yet another level of indirection?

IOW, does the following patch work for you as well? I might overlook
something, and I didn't build any test case yet, however.


diff --git a/names.c b/names.c
index 341f9e9..dfc1fca 100644
--- a/names.c
+++ b/names.c
@@ -253,8 +253,12 @@ void kdbus_name_remove_by_conn(struct
kdbus_name_registry *reg,
        list_for_each_entry_safe(q, q_tmp, &names_queue_list, conn_entry)
-       list_for_each_entry_safe(e, e_tmp, &names_list, conn_entry)
+       list_for_each_entry_safe(e, e_tmp, &names_list, conn_entry) {
+               if (conn == e->activator)
+                       e->activator = kdbus_conn_unref(conn);
                kdbus_name_entry_release(e, &notify_list);
+       }

More information about the systemd-devel mailing list