[systemd-commits] 2 commits - TODO src/core

Lennart Poettering lennart at kemper.freedesktop.org
Wed Nov 26 08:28:05 PST 2014


 TODO               |    1 -
 src/core/busname.c |   19 +++++++++++++------
 2 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit 6dae84cbdda6c0547b374119960b49c9da5aa481
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Nov 26 17:27:13 2014 +0100

    update TODO

diff --git a/TODO b/TODO
index f97b033..a1581a6 100644
--- a/TODO
+++ b/TODO
@@ -258,7 +258,6 @@ Features:
 
 * sd-bus:
   - systemd-bus-proxyd needs to enforce good old XML policy
-  - kdbus: peeking is subject to a race when we look at a message while the message is being migrated to the implementor's connection. Needs kernel fix, and then we need to invoke the FREE ioctl in busname_peek_message()
   - kdbus: maybe add controlling tty and ppid metadata fields
   - kdbus: for some reason "busctl monitor" only shows metadata for signal msgs, never method call or method reply msgs
   - kdbus: busnames.target should get pulled in by basic.target

commit dcc2fc01fa850e9ee36c549dc2691e7e5c71bebf
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Nov 26 15:54:53 2014 +0100

    sd-bus: update peeking into receieved messages, with recent kernel change we need to FREE them after all

diff --git a/src/core/busname.c b/src/core/busname.c
index 1583d57..8926c6b 100644
--- a/src/core/busname.c
+++ b/src/core/busname.c
@@ -731,6 +731,7 @@ static int busname_peek_message(BusName *n) {
         struct kdbus_cmd_recv cmd_recv = {
                 .flags = KDBUS_RECV_PEEK,
         };
+        struct kdbus_cmd_free cmd_free = {};
         const char *comm = NULL;
         struct kdbus_item *d;
         struct kdbus_msg *k;
@@ -739,11 +740,17 @@ static int busname_peek_message(BusName *n) {
         pid_t pid = 0;
         int r;
 
+        /* Generate a friendly debug log message about which process
+         * caused triggering of this bus name. This simply peeks the
+         * metadata of the first queued message and logs it. */
+
         assert(n);
 
-        /* Generate a friendly log message about which process caused
-         * triggering of this bus name. This simply peeks the metadata
-         * of the first queued message and logs it. */
+        /* Let's shortcut things a bit, if debug logging is turned off
+         * anyway. */
+
+        if (log_get_max_level() < LOG_DEBUG)
+                return 0;
 
         r = ioctl(n->starter_fd, KDBUS_CMD_MSG_RECV, &cmd_recv);
         if (r < 0) {
@@ -795,9 +802,9 @@ finish:
         if (p)
                 (void) munmap(p, sz);
 
-        /* Hint: we don't invoke KDBUS_CMD_MSG_FREE here, as we only
-         * PEEKed the message, and didn't ask for it to be dropped
-         * from the queue. */
+        cmd_free.offset = cmd_recv.offset;
+        if (ioctl(n->starter_fd, KDBUS_CMD_FREE, &cmd_free) < 0)
+                log_warning_unit(UNIT(n)->id, "Failed to free peeked message, ignoring: %m");
 
         return r;
 }



More information about the systemd-commits mailing list