All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dbus: Avoid EPOLL_CTL_ADD on kdbus fd before hello command
@ 2016-04-05  2:04 Andrew Zaborowski
  2016-04-05 15:13 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Zaborowski @ 2016-04-05  2:04 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 1252 bytes --]

Reorder the kdbus initialisation to avoid epoll_ctl(fd, EPOLL_CTL_ADD,
...) being called (from watch_add in l_io_new in dbus_init) before
KDBUS_CMD_HELLO is sent.  On the kernel side the kdbus handle is in the
BUS_OWNER state until the hello command changes is to CONNECTED state,
and will exit from f_ops->poll and not do anything to make epoll work.
handle->conn is created only once in CONNECTED state but only the
first f_ops->poll call by a given eventpoll has a chance to add the
handle->conn->wait to its poll table.
---
 ell/dbus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ell/dbus.c b/ell/dbus.c
index dfeacbc..94d819a 100644
--- a/ell/dbus.c
+++ b/ell/dbus.c
@@ -1216,8 +1216,6 @@ static struct l_dbus *setup_kdbus(int fd)
 	dbus = &kdbus->super;
 	dbus->driver = &kdbus_ops;
 
-	dbus_init(dbus, fd);
-
 	if (_dbus_kernel_hello(fd, "ell-connection",
 				&kdbus->bloom_size, &kdbus->bloom_n_hash,
 				&kdbus->kdbus_id, &kdbus->kdbus_pool,
@@ -1227,6 +1225,8 @@ static struct l_dbus *setup_kdbus(int fd)
 		return NULL;
 	}
 
+	dbus_init(dbus, fd);
+
 	dbus->unique_name = l_strdup_printf(":1.%llu", kdbus->kdbus_id);
 
 	l_idle_oneshot(kdbus_ready, dbus, NULL);
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-05 15:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05  2:04 [PATCH] dbus: Avoid EPOLL_CTL_ADD on kdbus fd before hello command Andrew Zaborowski
2016-04-05 15:13 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.