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

Radoslaw Pajak r.pajak at samsung.local
Mon Feb 24 03:30:39 PST 2014

> On 02/24/2014 10:17 AM, Daniel Mack 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.

In our project it is possible that config files for activator connections may change so activator connections may disappear or appear again.
> > @@ -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.
> Daniel

Your patch works if the activator connection is still the owner of the name, but it doesn't work if activator has lost the ownership. If regular connection takes over the name than kdbus_name_replace_owner calls kdbus_name_entry_remove_owner which removes e->conn_entry from the names list of the activator connection, which you wanted to use. If activator connection has closed than, there is stil e->activator pointer to this non existing connection which is bug by itself and new activator connection cannot acquire that name. Without our patch there is no link between the activator connection and name_entry.

Best Regards,
Radoslaw Pajak

More information about the systemd-devel mailing list