1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-25 23:21:33 +03:00
Commit Graph

36858 Commits

Author SHA1 Message Date
Lennart Poettering
6e64994d69 core: make unit_start() return a distinguishable error code in case conditions didn't hold
Ideally we'd even propagate this all the way to the client, by having a
separate JobType enum value for this. But it's hard to add this without
breaking compat, hence for now let's at least internally propagate this
case differently from the case "already on it".

This is then used to call job_finish_and_invalidate() slightly
differently, with the already= parameter false, as in the failed
condition case no message was likely produced so far.
2018-11-16 15:22:48 +01:00
Lennart Poettering
0e2b4a822e job: add two explanatory comments 2018-11-16 15:22:48 +01:00
Lennart Poettering
a69b3872ac job: let's remove one comparison and reduce indentation level by one 2018-11-16 15:22:48 +01:00
Lennart Poettering
523ee2d414 core: log a recognizable message when a unit succeeds, too
We already are doing it on failure, let's do it on success, too.

Fixes: #10265
2018-11-16 15:22:48 +01:00
Lennart Poettering
91bbd9b796 core: make log messages about unit processes exiting recognizable 2018-11-16 15:22:48 +01:00
Lennart Poettering
7c047d7443 core: make log messages about units entering a 'failed' state recognizable
Let's make this recognizable, and carry result information in a
structure fashion.
2018-11-16 15:22:48 +01:00
Lennart Poettering
295f31b0b7 sd-messages: add comment and reorder a bit
The message SD_MESSAGE_UNIT_FAILED is closely related to
SD_MESSAGE_UNIT_STARTED as it is generated when a start job failed
instead of completed successfully, Hence they should be placed together.

Otherwise one might get the impression that the message was about
failing units, which it really is not.
2018-11-16 15:22:48 +01:00
Lennart Poettering
0b999d34b1 catalog: update job begin/done messages
These texts have been slightly misleading previously, as they talked
about units, not jobs, but are actually generated for jobs, not units.
This difference matters as units can change state without a job
requesting that.

Also, the message be02cf6855d2428ba40df7e9d022f03d was particularly
wrong, as it claimed the unit failed, while it actually is the start job
that failed, which is a major difference, as jobs can fail without the
unit actually being placed in a failed state. Let's move this message a
bit up, closed to 39f53479d3a045ac8e11786248231fbf (i.e. the message
seen when a start job finished successfully).
2018-11-16 15:22:48 +01:00
Lennart Poettering
b344b363ce job: also include job ID in log messages when we begin with a job 2018-11-16 15:22:48 +01:00
Lennart Poettering
33a3fdd978 core: move unit_status_emit_starting_stopping_reloading() and related calls to job.c
This call is only used by job.c and very specific to job handling.
Moreover the very similar logic of job_emit_status_message() is already
in job.c.

Hence, let's clean this up, and move both sets of functions to job.c,
and rename them a bit so that they express precisely what they do:

1. unit_status_emit_starting_stopping_reloading() →
   job_emit_begin_status_message()
2. job_emit_status_message() → job_emit_done_status_message()

The first call is after all what we call when we begin with the
execution of a job, and the second call what we call when we are done
wiht it.

Just some moving and renaming, not other changes, and hence no change in
behaviour.
2018-11-16 15:22:48 +01:00
Lennart Poettering
f8c34706f5 job: add log message when we can't enable the job run event source 2018-11-16 15:22:48 +01:00
Lennart Poettering
8ebd9175db job: add comment for EAGAIN job run case 2018-11-16 15:22:48 +01:00
Lennart Poettering
ea2c0e4526 job: minor coding style tweaks 2018-11-16 15:22:48 +01:00
Lennart Poettering
1cd81629e1 job: include JOB_ID field in log message about jobs 2018-11-16 15:22:48 +01:00
Evgeny Vereshchagin
a7891d203c tests: run fuzzers four times in a row (#10794)
This should help to catch issues that are easily detectable by
bad_build_check like the one being fixed in https://github.com/systemd/systemd/pull/10793,
which would totally break the build tomorrow if I hadn't run
`helper.py check_build` manually.
2018-11-16 23:09:24 +09:00
Yu Watanabe
ff4b032106 sd-ndisc: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe
144faa8ea5 sd-ndisc: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe
807a8edeb1 sd-radv: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe
78f9d24f7b sd-radv: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe
6ec11d46dc lldp: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe
8158b90d59 lldp: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe
32ab66c5ee ipv4acd: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe
4ca5acb35f ipv4acd: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe
c9393e8c41 dhcp6-client: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe
8b8ecac85b dhcp6-client: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Benjamin Berg
a5f07d2a16 sd-dhcp6: fix crash by unrefing event sources before re-adding them
In certain cases the timeouts may not have been unref'ed before they
need to be re-added. Add the appropriate unref calls to ensure we don't
register the timeout multiple times.

This fixes possible cases where timeouts are triggered multiple times
and even on destroyed DHCPv6 clients.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/73

Fixes #10749.
2018-11-16 22:57:42 +09:00
Yu Watanabe
a3fa4287f5 dhcp-client: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe
be6bf4a786 dhcp-client: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe
0725c4b9d1 udevd: use event_source_disable() 2018-11-16 22:57:42 +09:00
Yu Watanabe
6d63048a77 udevd: use event_reset_time() to update kill_workers_event 2018-11-16 22:57:42 +09:00
Yu Watanabe
d44325cb96 sd-event: also introduce event_source_is_enabled() 2018-11-16 22:57:42 +09:00
Yu Watanabe
2701983ce8 sd-event: introduce event_source_disable() 2018-11-16 22:57:42 +09:00
Yu Watanabe
764c08e6b7 sd-event: introduce event_reset_time() 2018-11-16 22:57:42 +09:00
Yu Watanabe
a137a1c3ff sd-event: split definition of event_source to event-source.h 2018-11-16 22:57:37 +09:00
Lennart Poettering
f54353406a update TODO 2018-11-16 14:54:13 +01:00
Lennart Poettering
e353faa0d6 cgroup-util: when attaching/creating cgroups in multiple hierarchies, take jointly mounted controlelrs into account
If we create a cgroup in one controller it might already have been
created in another too, if we have jointly mounted controllers. Take
that into consideration.
2018-11-16 14:54:13 +01:00
Lennart Poettering
fae9bc298a cgroup: when determining which controllers we need, always extend the mask according to cpu/cpuacct joint mounting
Note that for cgroup_context_get_mask() this doesn't actually change
much, but it does prepare the ground for #10507 later on.
2018-11-16 14:54:13 +01:00
Lennart Poettering
c01ef321af cgroup: add new helper that knows which controllers are mounted together 2018-11-16 14:54:13 +01:00
Lennart Poettering
143fadf369 core: remove JoinControllers= configuration setting
This removes the ability to configure which cgroup controllers to mount
together. Instead, we'll now hardcode that "cpu" and "cpuacct" are
mounted together as well as "net_cls" and "net_prio".

The concept of mounting controllers together has no future as it does
not exist to cgroupsv2. Moreover, the current logic is systematically
broken, as revealed by the discussions in #10507. Also, we surveyed Red
Hat customers and couldn't find a single user of the concept (which
isn't particularly surprising, as it is broken...)

This reduced the (already way too complex) cgroup handling for us, since
we now know whenever we make a change to a cgroup for one controller to
which other controllers it applies.
2018-11-16 14:54:13 +01:00
Lennart Poettering
8d33dca2ff core: fix capitalization of CPUShares= settings 2018-11-16 14:46:49 +01:00
Lennart Poettering
63a0cbbac3 cgtop: use FOREACH_STRING() for fun and profit 2018-11-16 14:46:49 +01:00
Lennart Poettering
fdaa23af94 cgtop: use automatic clean-up 2018-11-16 14:46:49 +01:00
Lennart Poettering
ac0a94f743 sd-bus: make strict asan shut up
asan doesn't like it if we use strndup() (i.e. a string function) on a
non-NULL terminated buffer (i.e. something that isn't really a string).

Let's hence use memdup_suffix0() instead of strndup(), which is more
appropriate for binary data that is to become a string.

Fixes: #10385
2018-11-16 14:32:41 +01:00
Lennart Poettering
899feb7225 man: let's deprecate PermissionsStartOnly=
The concept is redundant and predates the special chars that do the same
in ExecStar=. Let's settle on advertising just the latter, and hide
PermissionsStartOnly= from the docs (even if we continue supporting it).
2018-11-16 14:31:37 +01:00
Zbigniew Jędrzejewski-Szmek
62adb5d085
Merge pull request #10795 from poettering/generator-fixes
trivial fixes to some generators
2018-11-16 14:30:53 +01:00
Zbigniew Jędrzejewski-Szmek
524f8a4aea
Merge pull request #10796 from poettering/systemd-exit-service-fixes
units: corrections for systemd-exit.service
2018-11-16 14:29:20 +01:00
Elias Probst
adb4c246c1
zsh-completion: typo (proerties > properties) 2018-11-16 13:27:56 +00:00
Elias Probst
ed251bf26b
zsh-completion: complete available, not running machines for clone 2018-11-16 13:27:02 +00:00
Lennart Poettering
567e5d5549
Merge pull request #10791 from keszybz/sd-event-get-enabled
Some minor tweaks for sd_event_source_get_enabled
2018-11-16 12:46:30 +01:00
Evgeny Vereshchagin
cc55ac0171 test: initialize syslog_fd in fuzz-journald-kmsg too
This is a follow-up to 8857fb9beb that prevents the fuzzer from crashing with
```
==220==ERROR: AddressSanitizer: ABRT on unknown address 0x0000000000dc (pc 0x7ff4953c8428 bp 0x7ffcf66ec290 sp 0x7ffcf66ec128 T0)
SCARINESS: 10 (signal)
    #0 0x7ff4953c8427 in gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35427)
    #1 0x7ff4953ca029 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x37029)
    #2 0x7ff49666503a in log_assert_failed_realm /work/build/../../src/systemd/src/basic/log.c:805:9
    #3 0x7ff496614ecf in safe_close /work/build/../../src/systemd/src/basic/fd-util.c:66:17
    #4 0x548806 in server_done /work/build/../../src/systemd/src/journal/journald-server.c:2064:9
    #5 0x5349fa in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/fuzz/fuzz-journald-kmsg.c:26:9
    #6 0x592755 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:571:15
    #7 0x590627 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:480:3
    #8 0x594432 in fuzzer::Fuzzer::MutateAndTestOne() /src/libfuzzer/FuzzerLoop.cpp:708:19
    #9 0x5973c6 in fuzzer::Fuzzer::Loop(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:839:5
    #10 0x574541 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:764:6
    #11 0x5675fc in main /src/libfuzzer/FuzzerMain.cpp:20:10
    #12 0x7ff4953b382f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #13 0x420f58 in _start (/out/fuzz-journald-kmsg+0x420f58)
```
2018-11-16 12:44:47 +01:00