Commit graph

23478 commits

Author SHA1 Message Date
Lennart Poettering 020b39497a tree-wide: use SWAP_TWO a bit more 2018-11-26 22:17:34 +01:00
Lennart Poettering f5d9a12780
Merge pull request #10928 from yuwata/fix-9940
network: also load foo.netdev.d/*.conf
2018-11-26 18:46:47 +01:00
Lennart Poettering a0ee3d93bb
Merge pull request #10919 from yuwata/sd-device-monitor-fixes
sd-device-monitor: several fixes
2018-11-26 18:08:41 +01:00
Harald Hoyer 4e9322048b generator.c: systemd-fsck-root.service conflict with shutdown.target
Otherwise a "reboot" or "poweroff" in the initramfs will have to wait
until systemd-fsck-root.service has completed, which might never happen
if the root device never shows up.
2018-11-26 16:51:22 +01:00
Yu Watanabe 938dbb292a
Merge pull request #10901 from poettering/startswith-list
add new STARTSWITH_SET() macro
2018-11-26 22:40:51 +09:00
Lennart Poettering a7f71a01b8
Merge pull request #10927 from yuwata/udev-ctrl-cleanup
udev: update log messages and fix coding style issues
2018-11-26 14:23:28 +01:00
Lennart Poettering 91419787f0
Merge pull request #10925 from yuwata/sd-boot-fixes
sd-boot: fixes trailing whitespace trimming and updates document
2018-11-26 14:20:36 +01:00
Lennart Poettering a666d07eac
Merge pull request #10910 from yuwata/list-cleanups
basic/list: tiny fixes
2018-11-26 14:19:03 +01:00
Lennart Poettering 50891a20ea
Merge pull request #10909 from yuwata/import-cleanups
Import: cleanups
2018-11-26 14:18:23 +01:00
Lennart Poettering 9630d4dd68
Merge pull request #10894 from poettering/root-cgroup-fix
A multitude of cgroup fixes
2018-11-26 14:13:01 +01:00
Lennart Poettering 3ebc048b6b terminal-util: use PATH_STARTSWITH_SET() instead of plain startswith() where appropriate
After all, we deal with paths here.
2018-11-26 14:08:46 +01:00
Lennart Poettering b48a0e0956 journal-upload: use static initialization 2018-11-26 14:08:46 +01:00
Lennart Poettering 15d121b0e2 journal-remote: shorten code a bit by using strcspn() 2018-11-26 14:08:46 +01:00
Lennart Poettering da9fc98ded tree-wide: port more code over to PATH_STARTSWITH_SET() 2018-11-26 14:08:46 +01:00
Lennart Poettering d898ed65ab path-util: beef up PATH_STARTSWITH_SET() macro a bit
Let's remove duplicate evaluation, and let's return the result of the
succesful path_startswith() call, i.e. the suffix to the matching
prefix.
2018-11-26 14:08:46 +01:00
Lennart Poettering 0cbd293e12 tree-wide: port over more cases to STR_IN_SET() 2018-11-26 14:08:46 +01:00
Lennart Poettering 49fe5c0996 tree-wide: port various places over to STARTSWITH_SET() 2018-11-26 14:08:46 +01:00
Lennart Poettering 52f1552073 strv: add new macro STARTSWITH_SET()
This is to startswith() what PATH_STARTSWITH_SET() is to
path_startswith().

Or in other words, checks if the specified string has any of the listed
prefixes, and if so, returns the remainder of the string.
2018-11-26 14:06:01 +01:00
Evgeny Vereshchagin 2e646cbed8 tests: add a fuzzer for the udev rules parser (#10929) 2018-11-26 18:14:30 +09:00
Yu Watanabe 6ce611e57c network: also load foo.netdev.d/*.conf
Fixes #9940.
2018-11-26 14:28:44 +09:00
Yu Watanabe 6acf1ccba5 udevd: do not call udev_ctrl_enable_receiving() if the socket is passed from pid1
Before c4b69e990f, if the socket fd is
passed from pid1, `udev_ctrl_enable_receiving()` was not called.
Let's preserve the original logic.
2018-11-26 11:57:48 +09:00
Yu Watanabe 49c603bd5e udev: drop duplicate whitespaces 2018-11-26 11:53:21 +09:00
Yu Watanabe 572909a38a udev-ctrl: update log messages 2018-11-26 11:52:40 +09:00
Yu Watanabe b4ba2fe3f1 udev-rules: include device sysname in log messages 2018-11-26 11:37:29 +09:00
Yu Watanabe 9315f853c4 udev-ctrl: fix coding style isuues 2018-11-26 11:10:46 +09:00
Yu Watanabe d949c467b8 sd-boot: fix trailing whitespace trimming
Fixes #10922.
2018-11-26 06:43:36 +09:00
Yu Watanabe 986ab0d2dc udevd: do not set buffer size if the socket is passed from pid1
Before c4b69e990f, if the socket fd is
passed from pid1, `udev_monitor_set_receive_buffer_size()` (now it is
a wrapper of `sd_device_monitor_set_receive_buffer_size()`) was not
called. Let's preserve the original logic.
2018-11-25 20:17:25 +09:00
Yu Watanabe 916707cca5 sd-device: do not call device_monitor_enable_receiving() for passed fd from pid1
Before c4b69e990f, if the socket fd is
passed from pid1, `udev_monitor_enable_receiving()` (now it is a wrapper
of `device_monitor_enable_receiving`) was not called.
Let's preserve the original logic.

Fixes #10754.
2018-11-25 20:14:17 +09:00
Yu Watanabe f1d7b7874e sd-device: check whether filter is updated or not in sd_device_monitor_filter_update() 2018-11-25 15:26:43 +09:00
Yu Watanabe 5cee547a94 sd-device: update log message 2018-11-25 14:06:56 +09:00
Yu Watanabe 779c923467 sd-device: fix return value on error path 2018-11-25 14:06:27 +09:00
Evgeny Vereshchagin 176ceb2c47 tests: skip test-execute on TravisCI under ASan
Unfortunately, f5f9a580dd didn't help much and now
the next subtest gets stuck from time to time. Let's skip
test-execute altogether so as not to bother anybody with
spurious failures.

https://github.com/systemd/systemd/issues/10696 is still open.
Everybody is welcome to share ideas :-)
2018-11-24 06:05:23 +03:00
Yu Watanabe 0d7f7c2fde basic/list: fix minor coding style issue 2018-11-24 04:26:10 +09:00
Yu Watanabe 1492fa526e basic/list: add missing header
Some macros use assert() which is (re)defined in macro.h
2018-11-24 04:25:10 +09:00
Yu Watanabe 0d94088e4e import: use structured initializers 2018-11-24 03:53:18 +09:00
Yu Watanabe c3e658004a import: use _cleanup_ attribute for CURL object 2018-11-24 03:14:32 +09:00
Michal Koutný d3340e6f95 analyze: Fix build without seccomp (#10899) 2018-11-24 02:40:32 +09:00
Evgeny Vereshchagin a4aa59bae2 tests: add a fuzzer for server_process_native_file 2018-11-23 17:29:59 +01:00
Thomas Haller 0e408b82b8 dhcp6-client: handle IAID with value zero
config_parse_iaid(), dhcp_identifier_set_iaid() and sd_dhcp6_client_set_iaid() all
allow for the IAID to be zero. Also, RFC 3315 makes no mention that zero
would be invalid.

However, client_ensure_iaid() would take an IAID of zero as a sign that
the values was unset. Fix that by keeping track whether IAID is
initialized.
2018-11-23 17:09:29 +01:00
Lennart Poettering acf2932711
Merge pull request #10887 from poettering/run-love
systemd-run: modernizations, some new switches and let's set $INVOCATION_ID
2018-11-23 16:00:16 +01:00
Lennart Poettering b8b6f32104 cgroup: when we unload a unit, also update all its parent's members mask
This way we can corectly ensure that when a unit that requires some
controller goes away, we propagate the removal of it all the way up, so
that the controller is turned off in all the parents too.
2018-11-23 13:41:37 +01:00
Lennart Poettering 5af8805872 cgroup: drastically simplify caching of cgroups members mask
Previously we tried to be smart: when a new unit appeared and it only
added controllers to the cgroup mask we'd update the cached members mask
in all parents by ORing in the controller flags in their cached values.
Unfortunately this was quite broken, as we missed some conditions when
this cache had to be reset (for example, when a unit got unloaded),
moreover the optimization doesn't work when a controller is removed
anyway (as in that case there's no other way for the parent to iterate
though all children if any other, remaining child unit still needs it).
Hence, let's simplify the logic substantially: instead of updating the
cache on the right events (which we didn't get right), let's simply
invalidate the cache, and generate it lazily when we encounter it later.
This should actually result in better behaviour as we don't have to
calculate the new members mask for a whole subtree whever we have the
suspicion something changed, but can delay it to the point where we
actually need the members mask.

This allows us to simplify things quite a bit, which is good, since
validating this cache for correctness is hard enough.

Fixes: #9512
2018-11-23 13:41:37 +01:00
Lennart Poettering 8a0d538815 cgroup: extend comment on what unit_release_cgroup() is for 2018-11-23 13:41:37 +01:00
Lennart Poettering 1fd3a10c38 cgroup: extend reasons when we realize the enable mask
After creating a cgroup we need to initialize its
"cgroup.subtree_control" file with the controllers its children want to
use. Currently we do so whenever the mkdir() on the cgroup succeeded,
i.e. when we know the cgroup is "fresh". Let's update the condition
slightly that we also do so when internally we assume a cgroup doesn't
exist yet, even if it already does (maybe left-over from a previous
run).

This shouldn't change anything IRL but make things a bit more robust.
2018-11-23 13:41:37 +01:00
Lennart Poettering d5095dcd30 cgroup: tighten call that detects whether we need to realize a unit's cgroup a bit, and comment why 2018-11-23 13:41:37 +01:00
Lennart Poettering 5a62e5e2ac cgroup: document what the various masks variables are used for 2018-11-23 13:41:37 +01:00
Lennart Poettering 67558d15ec cgroup: extend cg_mask_supported() comment a bit 2018-11-23 13:41:37 +01:00
Lennart Poettering 27c4ed790a cgroup: simplify check whether it makes sense to realize a cgroup 2018-11-23 13:41:37 +01:00
Lennart Poettering e00068e71f cgroup: in unit_invalidate_cgroup() actually modify invalidation mask
Previously this would manipulate the realization mask for invalidating
the realization. This is a bit ugly though as the realization mask's
primary purpose to is to reflect in which hierarchies a cgroup currently
exists, and it's probably a good idea to keep that in sync with
realities.

We nowadays have the an explicit fields for invalidating cgroup
controller information, the "cgroup_invalidated_mask", let's use this
one instead.

The effect is pretty much the same, as the main consumer of these masks
(unit_has_mask_realize()) checks both anyway.
2018-11-23 13:41:37 +01:00
Lennart Poettering 27adcc9737 cgroup: be more careful with which controllers we can enable/disable on a cgroup
This changes cg_enable_everywhere() to return which controllers are
enabled for the specified cgroup. This information is then used to
correctly track the enablement mask currently in effect for a unit.
Moreover, when we try to turn off a controller, and this works, then
this is indicates that the parent unit might succesfully turn it off
now, too as our unit might have kept it busy.

So far, when realizing cgroups, i.e. when syncing up the kernel
representation of relevant cgroups with our own idea we would strictly
work from the root to the leaves. This is generally a good approach, as
when controllers are enabled this has to happen in root-to-leaves order.
However, when controllers are disabled this has to happen in the
opposite order: in leaves-to-root order (this is because controllers can
only be enabled in a child if it is already enabled in the parent, and
if it shall be disabled in the parent then it has to be disabled in the
child first, otherwise it is considered busy when it is attempted to
remove it in the parent).

To make things complicated when invalidating a unit's cgroup membershup
systemd can actually turn off some controllers previously turned on at
the very same time as it turns on other controllers previously turned
off. In such a case we have to work up leaves-to-root *and*
root-to-leaves right after each other. With this patch this is
implemented: we still generally operate root-to-leaves, but as soon as
we noticed we successfully turned off a controller previously turned on
for a cgroup we'll re-enqueue the cgroup realization for all parents of
a unit, thus implementing leaves-to-root where necessary.
2018-11-23 13:41:37 +01:00