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

Radoslaw Pajak r.pajak at samsung.com
Mon Feb 24 00:39:12 PST 2014


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.

Signed-off-by: Radoslaw Pajak <r.pajak at samsung.com>
---
 connection.h |    1 +
 names.c      |    7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/connection.h b/connection.h
index 858be94..34540c7 100644
--- a/connection.h
+++ b/connection.h
@@ -68,6 +68,7 @@ struct kdbus_conn {
 	struct list_head monitor_entry;
 	struct list_head names_list;
 	struct list_head names_queue_list;
+	struct kdbus_name_entry *activator_of;
 	struct list_head reply_list;
 	atomic_t reply_count;
 	size_t names;
diff --git a/names.c b/names.c
index 22ead9f..762871b 100644
--- a/names.c
+++ b/names.c
@@ -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);
 
@@ -418,6 +420,7 @@ int kdbus_name_acquire(struct kdbus_name_registry *reg,
 		if (conn->flags & KDBUS_HELLO_ACTIVATOR &&
 		    e->activator == NULL) {
 			e->activator = kdbus_conn_ref(conn);
+			conn->activator_of = e;
 			goto exit_unlock;
 		}
 
@@ -486,8 +489,10 @@ int kdbus_name_acquire(struct kdbus_name_registry *reg,
 		goto exit_unlock;
 	}
 
-	if (conn->flags & KDBUS_HELLO_ACTIVATOR)
+	if (conn->flags & KDBUS_HELLO_ACTIVATOR) {
 		e->activator = kdbus_conn_ref(conn);
+		conn->activator_of = e;
+	}
 
 	e->flags = *flags;
 	INIT_LIST_HEAD(&e->queue_list);
-- 
1.7.9.5




More information about the systemd-devel mailing list