Bug 88284 - Setting ShutdownWatchdogUSec via D-Bus does nothing
Summary: Setting ShutdownWatchdogUSec via D-Bus does nothing
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-11 00:43 UTC by Maxim Mikityanskiy
Modified: 2015-01-30 23:51 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Make org.freedesktop.systemd1.Manager.ShutdownWatchdogUSec work (324 bytes, text/plain)
2015-01-11 00:43 UTC, Maxim Mikityanskiy
Details
Make org.freedesktop.systemd1.Manager.ShutdownWatchdogUSec work [2] (388 bytes, patch)
2015-01-30 10:52 UTC, Maxim Mikityanskiy
Details | Splinter Review

Description Maxim Mikityanskiy 2015-01-11 00:43:18 UTC
Created attachment 112081 [details]
Make org.freedesktop.systemd1.Manager.ShutdownWatchdogUSec work

org.freedesktop.systemd1.Manager has a property ShutdownWatchdogUSec. I can change it using the following command:

busctl --system set-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager ShutdownWatchdogUSec t 0

But it seems that this change has no effect, and systemd still uses old value which is read from /etc/systemd/system.conf at startup.

I looked at sources: http://cgit.freedesktop.org/systemd/systemd/tree/src/core/main.c?id=1325ec4280dd3f00f4879c5feadd524f7ba52f7e#n2014

I see that systemd uses arg_shutdown_watchdog value (the one assigned from config file) instead of m->shutdown_watchdog (the one that user could change by D-Bus calls). Really, we can't use m->shutdown_watchdog at that point, because m is freed on line 1827, but we could assign arg_shutdown_watchdog = m->shutdown_watchdog right before manager_free(m).

I suggest attached patch to fix this issue.
Comment 1 Lennart Poettering 2015-01-29 00:41:55 UTC
Patch looks good! Thanks! Applied!

http://cgit.freedesktop.org/systemd/systemd/commit/?id=df6e44c4affced590b0d19c594d9301ffd436591
Comment 2 Kay Sievers 2015-01-30 10:06:33 UTC
Reverted the patch. It causes systemd --version to segfault.
Please fix it and resubmit. Thanks!
Comment 3 Maxim Mikityanskiy 2015-01-30 10:52:39 UTC
Created attachment 112970 [details] [review]
Make org.freedesktop.systemd1.Manager.ShutdownWatchdogUSec work [2]
Comment 4 Maxim Mikityanskiy 2015-01-30 10:53:46 UTC
(In reply to Kay Sievers from comment #2)
> Reverted the patch. It causes systemd --version to segfault.
> Please fix it and resubmit. Thanks!

Sorry about that, I overlooked that m may be NULL. There is a new patch that assigns arg_shutdown_watchdog only if m is not NULL. In the case m == NULL (e.g. when calling systemd --version) we don't need arg_shutdown_watchdog anyway, we only need it on shutdown when m is definitely not NULL.
Comment 5 Zbigniew Jedrzejewski-Szmek 2015-01-30 23:51:19 UTC
(Re-)applied in http://cgit.freedesktop.org/systemd/systemd/commit/?id=81f5fc2d43.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.