commit c5d452bb228e9f97ebc96be98a957c0b7b8072eb
Author: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Date:   Sun Jun 21 05:59:34 2015 +0200

    pam_systemd: Properly check kdbus availability
    
    This properly avoids setting DBUS_SESSION_BUS_ADDRESS if kdbus
    is loaded (or built into the kernel) but not wanted.

diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
index 0ebdfdf..dd192b9 100644
--- a/src/login/pam_systemd.c
+++ b/src/login/pam_systemd.c
@@ -181,7 +181,7 @@ static int export_legacy_dbus_address(
         int r;
 
         /* skip export if kdbus is not active */
-        if (access("/sys/fs/kdbus", F_OK) < 0)
+        if (!is_kdbus_available())
                 return PAM_SUCCESS;
 
         if (asprintf(&s, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, uid, runtime) < 0) {
commit 084918ba41acbb80076c64e7338cf73101b1385e
Author: Abdo Roig-Maranges <abdo.roig@gmail.com>
Date:   Tue Jun 23 11:13:13 2015 +0200

    core: fix reversed dependency check in unit_check_unneeded
    
    This was introduced by commit be7d9ff730cb88d7c6a8 and breaks
    StopWhenUnneeded=true in the presence of a Requisite dependency.

diff --git a/src/core/unit.c b/src/core/unit.c
index 7bb2afc..fac017c 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1596,7 +1596,7 @@ static void unit_check_unneeded(Unit *u) {
         static const UnitDependency needed_dependencies[] = {
                 UNIT_REQUIRED_BY,
                 UNIT_REQUIRED_BY_OVERRIDABLE,
-                UNIT_REQUISITE,
+                UNIT_REQUISITE_OF,
                 UNIT_REQUISITE_OF_OVERRIDABLE,
                 UNIT_WANTED_BY,
                 UNIT_BOUND_BY,
commit e2452eef02a839e1928f4ffd893c93a460474ab6
Author: Kay Sievers <kay@vrfy.org>
Date:   Wed Jun 24 13:10:07 2015 +0200

    rules: remove all power management from udev
    
    It is not udev's task to apply any of these setting that way, or
    from udev rules files. Things need to be sortet out in the kernel,
    or explicit whitelist can possibly be added to the hardware database.
    Until that is sorted out, and general agreement, udev is not
    willing to maintain any such lists or power management settings
    in general.
    
    "Thanks for digging this out! I thought my Kinesis keyboard got broken
    and ordered a new one, only to find out that the new one doesn't work
    as well. I'm not sure whether we should start collecting a blacklist
    of keyboards which don't work with USB autosuspend, or rather a
    whitelist? Or revert this wholesale?"
    
      https://github.com/systemd/systemd/issues/340

diff --git a/Makefile.am b/Makefile.am
index 0f1028b..5c58e57 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3486,7 +3486,6 @@ dist_network_DATA = \
 	network/80-container-ve.network
 
 dist_udevrules_DATA += \
-	rules/42-usb-hid-pm.rules \
 	rules/50-udev-default.rules \
 	rules/60-block.rules \
 	rules/60-drm.rules \
diff --git a/rules/42-usb-hid-pm.rules b/rules/42-usb-hid-pm.rules
deleted file mode 100644
index 3721219..0000000
--- a/rules/42-usb-hid-pm.rules
+++ /dev/null
@@ -1,36 +0,0 @@
-# do not edit this file, it will be overwritten on update
-#
-# Enable autosuspend for qemu emulated usb hid devices
-
-# Note that there are buggy qemu versions (0.13 & older) which
-# advertise remote wakeup support but don't actually implement
-# it correctly.  This is the reason why we need a match for the
-# serial number here.  Old, broken versions have serial "1".
-# It has been changed to "42" after fixing the bug to indicate
-# remote wakeup is working.
-ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto"
-ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto"
-ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto"
-
-# Dell DRAC 4
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="413c", ATTR{idProduct}=="2500", TEST=="power/control", ATTR{power/control}="auto"
-
-# Dell DRAC 5
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="413c", ATTR{idProduct}=="0000", TEST=="power/control", ATTR{power/control}="auto"
-
-# IBM remote access
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04b3", ATTR{idProduct}=="4001", TEST=="power/control", ATTR{power/control}="auto"
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04b3", ATTR{idProduct}=="4002", TEST=="power/control", ATTR{power/control}="auto"
-ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="04b3", ATTR{idProduct}=="4012", TEST=="power/control", ATTR{power/control}="auto"
-
-# Raritan Computer, Inc KVM.
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="14dd", ATTR{idProduct}=="0002", TEST=="power/control", ATTR{power/control}="auto"
-
-# USB HID devices that are internal to the machine should also be safe to autosuspend
-
-ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTR{../removable}=="removable", GOTO="usb_hid_pm_end"
-ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTR{../removable}=="unknown", GOTO="usb_hid_pm_end"
-
-ACTION=="add", SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="03", ATTR{../removable}=="fixed", TEST=="../power/control", ATTR{../power/control}="auto"
-
-LABEL="usb_hid_pm_end"
commit 418b22b88f79911fe5d76fabedd18ef1eb491680
Author: Daniel Mack <daniel@zonque.org>
Date:   Mon Jun 8 22:58:50 2015 +0200

    logind: fix delayed execution regression
    
    Commit c0f32805 ("logind: use sd_event timer source for inhibitor
    logic") reworked the main loop logic of logind so that it uses a
    real timeout callback handler to execute delayed functions.
    
    What the old code did, however, was to call those functions on
    every iteration in the main loop, not only when the timeout
    expired.
    
    Restore that behavior by bringing back manager_dispatch_delayed(),
    and call it from manager_run(). The internal event source callback
    manager_inhibit_timeout_handler() was turned into a wrapper of
    manager_dispatch_delayed() now.

diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 8ebcd3f..640ae92 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -1486,18 +1486,13 @@ static int execute_shutdown_or_sleep(
         return 0;
 }
 
-static int manager_inhibit_timeout_handler(
-                        sd_event_source *s,
-                        uint64_t usec,
-                        void *userdata) {
+int manager_dispatch_delayed(Manager *manager, bool timeout) {
 
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
         Inhibitor *offending = NULL;
-        Manager *manager = userdata;
         int r;
 
         assert(manager);
-        assert(manager->inhibit_timeout_source == s);
 
         if (manager->action_what == 0 || manager->action_job)
                 return 0;
@@ -1505,6 +1500,9 @@ static int manager_inhibit_timeout_handler(
         if (manager_is_inhibited(manager, manager->action_what, INHIBIT_DELAY, NULL, false, false, 0, &offending)) {
                 _cleanup_free_ char *comm = NULL, *u = NULL;
 
+                if (!timeout)
+                        return 0;
+
                 (void) get_process_comm(offending->pid, &comm);
                 u = uid_to_name(offending->uid);
 
@@ -1520,9 +1518,25 @@ static int manager_inhibit_timeout_handler(
 
                 manager->action_unit = NULL;
                 manager->action_what = 0;
+                return r;
         }
 
-        return 0;
+        return 1;
+}
+
+static int manager_inhibit_timeout_handler(
+                        sd_event_source *s,
+                        uint64_t usec,
+                        void *userdata) {
+
+        Manager *manager = userdata;
+        int r;
+
+        assert(manager);
+        assert(manager->inhibit_timeout_source == s);
+
+        r = manager_dispatch_delayed(manager, true);
+        return (r < 0) ? r : 0;
 }
 
 static int delay_shutdown_or_sleep(
diff --git a/src/login/logind.c b/src/login/logind.c
index 01f7cd9..e2fb496 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -1109,6 +1109,12 @@ static int manager_run(Manager *m) {
 
                 manager_gc(m, true);
 
+                r = manager_dispatch_delayed(m, false);
+                if (r < 0)
+                        return r;
+                if (r > 0)
+                        continue;
+
                 r = sd_event_run(m->event, (uint64_t) -1);
                 if (r < 0)
                         return r;
diff --git a/src/login/logind.h b/src/login/logind.h
index feb381d..ad437b7 100644
--- a/src/login/logind.h
+++ b/src/login/logind.h
@@ -194,3 +194,5 @@ int manager_get_seat_from_creds(Manager *m, sd_bus_message *message, const char
 
 int manager_setup_wall_message_timer(Manager *m);
 bool logind_wall_tty_filter(const char *tty, void *userdata);
+
+int manager_dispatch_delayed(Manager *manager, bool timeout);
commit 0c9cc10dcca6cc260b293c2732e7a4833280272e
Author: David Herrmann <dh.herrmann@gmail.com>
Date:   Thu Jul 2 12:14:27 2015 +0200

    sd-bus: don't leak kdbus notifications
    
    When we get notifications from the kernel, we always turn them into
    synthetic dbus1 messages. This means, we do *not* consume the kdbus
    message, and as such have to free the offset.
    
    Right now, the translation-helpers told the caller that they consumed the
    message, which is wrong. Fix this by explicitly releasing all kernel
    messages that are translated.

diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index f08db2d..e3fac01 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -1385,15 +1385,16 @@ int bus_kernel_read_message(sd_bus *bus, bool hint_priority, int64_t priority) {
                         r = 0;
                 }
 
-        } else if (k->payload_type == KDBUS_PAYLOAD_KERNEL)
+                if (r <= 0)
+                        close_kdbus_msg(bus, k);
+        } else if (k->payload_type == KDBUS_PAYLOAD_KERNEL) {
                 r = bus_kernel_translate_message(bus, k);
-        else {
+                close_kdbus_msg(bus, k);
+        } else {
                 log_debug("Ignoring message with unknown payload type %llu.", (unsigned long long) k->payload_type);
                 r = 0;
-        }
-
-        if (r <= 0)
                 close_kdbus_msg(bus, k);
+        }
 
         return r < 0 ? r : 1;
 }
