]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
5 years agoMerge pull request #11083 from poettering/nspawn-settings-fixes
Zbigniew Jędrzejewski-Szmek [Tue, 11 Dec 2018 10:52:23 +0000 (11:52 +0100)] 
Merge pull request #11083 from poettering/nspawn-settings-fixes

read nspawn's .nspawn files before validating configuration

5 years agoMerge pull request #11084 from poettering/networkd-test-fix
Zbigniew Jędrzejewski-Szmek [Tue, 11 Dec 2018 10:37:05 +0000 (11:37 +0100)] 
Merge pull request #11084 from poettering/networkd-test-fix

unbreak networkd-test.py

5 years agoLogitech MX Master 2S: Unifying Receiver and Bluetooth Connectivity (#11078)
Emil Soleyman [Tue, 11 Dec 2018 01:18:20 +0000 (01:18 +0000)] 
Logitech MX Master 2S: Unifying Receiver and Bluetooth Connectivity (#11078)

* Logitech MX Master 2S: Unifying Receiver and Bluetooth Connectivity

Logitech MX Master 2S can connect through either the unifying receiver
or bluetooth. Clarify that the previous listing was for unifying
receiver and add listing for bluetooth. Note the MOUSE_DPI differences
between the two listings.

5 years agoMerge pull request #11109 from poettering/cgroup-cpu-acct-fixes
Lennart Poettering [Mon, 10 Dec 2018 17:27:28 +0000 (18:27 +0100)] 
Merge pull request #11109 from poettering/cgroup-cpu-acct-fixes

cgroup cpuacct controller handling fixes

5 years agoupdate TODO 11109/head
Lennart Poettering [Mon, 10 Dec 2018 15:09:30 +0000 (16:09 +0100)] 
update TODO

5 years agocgroup: correct mangling of return values
Lennart Poettering [Mon, 10 Dec 2018 15:08:33 +0000 (16:08 +0100)] 
cgroup: correct mangling of return values

Let's nor return the unmangled return value before we actually mangle
it.

Fixes: #11062
5 years agocgroup: call cg_all_unified() right before using the result
Lennart Poettering [Mon, 10 Dec 2018 15:08:13 +0000 (16:08 +0100)] 
cgroup: call cg_all_unified() right before using the result

Let's not query it before we actually need it.

5 years agoMerge pull request #11105 from keszybz/path-parsing
Lennart Poettering [Mon, 10 Dec 2018 14:50:08 +0000 (15:50 +0100)] 
Merge pull request #11105 from keszybz/path-parsing

Some tightening of our path parsing code

5 years agonetwork: fix handling of uninitialized and zero IAID setting
Thomas Haller [Fri, 23 Nov 2018 21:19:26 +0000 (22:19 +0100)] 
network: fix handling of uninitialized and zero IAID setting

An earlier commit 0e408b82b (dhcp6-client: handle IAID with value zero)
introduced a flag to sd_dhcp6_client to distinguish between an unset
IAID and a value set to zero.

However, that was not sufficient and broke leaving the setting
uninitialized in networkd configuration. The configuration parsing
also must distinguish between the default, unset value and an
explict zero configuration.

Fixes: 0e408b82b8bd7675234cf58009475d4f4c0a491a
5 years agopid1: set Description even for devices which don't exist yet
Zbigniew Jędrzejewski-Szmek [Tue, 4 Dec 2018 13:24:46 +0000 (14:24 +0100)] 
pid1: set Description even for devices which don't exist yet

We'd only set the description after the device appeared in sysfs, so
we'd always print
"A start job is running for dev-disk-by\x2duuid-aaaa ... aaaa.device (42s / 1min 30s)"
Let's make this
"A start job is running for /dev/disk/by-duuid/aaaa ... aaaa (42s / 1min 30s)"

https://bugzilla.redhat.com/show_bug.cgi?id=1655860

5 years agoAdd RF kill switch button for Zbook 15 G2 (#11060) 11106/head
Cedric Viou [Mon, 10 Dec 2018 12:20:46 +0000 (13:20 +0100)] 
Add RF kill switch button for Zbook 15 G2 (#11060)

5 years agonspawn: move most validation checks and configuration mangling into verify_arguments() 11083/head
Lennart Poettering [Thu, 6 Dec 2018 21:00:00 +0000 (22:00 +0100)] 
nspawn: move most validation checks and configuration mangling into verify_arguments()

That's what the function is for after all, and only if it's done there
we can verify the effect of .nspawn files correctly too: after all we
should not just validate that everything configured on the command line
makes sense, but the stuff configured in the .nspawn files, too.

5 years agonspawn: split out code parsing env vars into a function of its own
Lennart Poettering [Thu, 6 Dec 2018 20:54:11 +0000 (21:54 +0100)] 
nspawn: split out code parsing env vars into a function of its own

This then let's us to ensure it's called after we parsed the cmdline,
and after we loaded the settings file, so that it these env var settings
override everything loaded from there.

5 years agonspawn: move cg_unified_flush() invocation out of parse_argv()
Lennart Poettering [Thu, 6 Dec 2018 20:49:11 +0000 (21:49 +0100)] 
nspawn: move cg_unified_flush() invocation out of parse_argv()

It has nothing to do with argument parsing, and hence shouldn't be
there.

5 years agoMerge pull request #10984 from fbuihuu/tmpfiles-be-more-explicit-with-unsafe-transition
Lennart Poettering [Mon, 10 Dec 2018 11:31:56 +0000 (12:31 +0100)] 
Merge pull request #10984 from fbuihuu/tmpfiles-be-more-explicit-with-unsafe-transition

tmpfiles: be more explicit when an unsafe path transition is met

5 years agoMerge pull request #10897 from keszybz/etc-fstab-parsing
Lennart Poettering [Mon, 10 Dec 2018 11:31:30 +0000 (12:31 +0100)] 
Merge pull request #10897 from keszybz/etc-fstab-parsing

Forbid dashes in hostnames and /etc/fstab parsing improvements

5 years agofuzz-unit-file: add one more test case 11105/head
Zbigniew Jędrzejewski-Szmek [Fri, 7 Dec 2018 15:49:20 +0000 (16:49 +0100)] 
fuzz-unit-file: add one more test case

There seems to be no error per se. RequiresMountsFor=%s%s%s..%s%s%s is expanded to
RequiresMountsFor=/bin/zsh/bin/zsh/bin/zsh/bin/zsh/..., which takes a bit of time,
and then we iterate over this a few times, creating a hashmap with a hashmap
for each prefix of the path, each with one item pointing back to the original unit.
Takes about 0.8 s on my machine.

5 years agoUse VLA instead of alloca
Zbigniew Jędrzejewski-Szmek [Fri, 7 Dec 2018 15:38:03 +0000 (16:38 +0100)] 
Use VLA instead of alloca

The test is the same, but an array is more readable.

5 years agopid1: fix (harmless) off-by-one in PATH_MAX comparison
Zbigniew Jędrzejewski-Szmek [Fri, 7 Dec 2018 15:22:10 +0000 (16:22 +0100)] 
pid1: fix (harmless) off-by-one in PATH_MAX comparison

PATH_MAX is supposed to include the terminating NUL byte. But we already
check that there is no NUL byte in the specified path. Hence the maximum
length we can expect is PATH_MAX - 1.

This doesn't change much, but makes this use of PATH_MAX consistent with the
rest of the codebase.

5 years agobasic/path-util: line-break PATH_FOREACH_PREFIX macros
Zbigniew Jędrzejewski-Szmek [Fri, 7 Dec 2018 15:16:39 +0000 (16:16 +0100)] 
basic/path-util: line-break PATH_FOREACH_PREFIX macros

Now I can see what they do :]

5 years agoWhen parsing paths, reject anything above PATH_MAX
Zbigniew Jędrzejewski-Szmek [Fri, 7 Dec 2018 15:12:19 +0000 (16:12 +0100)] 
When parsing paths, reject anything above PATH_MAX

The check for length is done after path_simplify(), to be nice to paths which
are constructed using specifiers, and have duplicate slashes and stuff.

5 years agoMerge pull request #11093 from yuwata/update-python-scripts-for-lgtm
Lennart Poettering [Mon, 10 Dec 2018 10:13:21 +0000 (11:13 +0100)] 
Merge pull request #11093 from yuwata/update-python-scripts-for-lgtm

Update python scripts for lgtm

5 years agosystemctl: check triggering units only for stopped units
Yu Watanabe [Sat, 8 Dec 2018 09:33:38 +0000 (18:33 +0900)] 
systemctl: check triggering units only for stopped units

Fixes #11088.

5 years agoMerge pull request #10999 from wkennington/static-neighbor-master
Lennart Poettering [Mon, 10 Dec 2018 10:04:14 +0000 (11:04 +0100)] 
Merge pull request #10999 from wkennington/static-neighbor-master

networkd: Static neighbor support

5 years agobasic/hostname-util: do truncation last when cleaning up 10897/head
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 11:27:29 +0000 (12:27 +0100)] 
basic/hostname-util: do truncation last when cleaning up

This allows more of the original name to be used if there are invalid
chars in the beginning.

5 years agoPartially unify hostname_is_valid() and dns_name_is_valid()
Zbigniew Jędrzejewski-Szmek [Wed, 5 Dec 2018 11:26:29 +0000 (12:26 +0100)] 
Partially unify hostname_is_valid() and dns_name_is_valid()

This makes hostname_is_valid() apply the ldh checks too, rejecting more
hostnames.

5 years agoresolve: reject host names with leading or trailing dashes in /etc/hosts
Zbigniew Jędrzejewski-Szmek [Wed, 21 Nov 2018 21:58:13 +0000 (22:58 +0100)] 
resolve: reject host names with leading or trailing dashes in /etc/hosts

https://tools.ietf.org/html/rfc1035#section-2.3.1 says (approximately)
that only letters, numbers, and non-leading non-trailing dashes are allowed
(for entries with A/AAAA records). We set no restrictions.

hosts(5) says:
> Host names may contain only alphanumeric characters, minus signs ("-"), and
> periods (".").  They must begin with an alphabetic character and end with an
> alphanumeric character.

nss-files follows those rules, and will ignore names in /etc/hosts that do not
follow this rule.

Let's follow the documented rules for /etc/hosts. In particular, this makes us
consitent with nss-files, reducing surprises for the user.

I'm pretty sure we should apply stricter filtering to names received over DNS
and LLMNR and MDNS, but it's a bigger project, because the rules differ
depepending on which level the label appears (rules for top-level names are
stricter), and this patch takes the minimalistic approach and only changes
behaviour for /etc/hosts.

Escape syntax is also disallowed in /etc/hosts, even if the resulting character
would be allowed. Other tools that parse /etc/hosts do not support this, and
there is no need to use it because no allowed characters benefit from escaping.

5 years agoresolved: rework parsing of /etc/hosts
Zbigniew Jędrzejewski-Szmek [Fri, 23 Nov 2018 14:52:38 +0000 (15:52 +0100)] 
resolved: rework parsing of /etc/hosts

Do not treat various errors (missing hostname, invalid address) as fatal,
just warn and continue. /etc/hosts is written by humans and we should not
reject the whole file just because a singly entry is not to our liking.

Handle comments as described in hosts(5):
everything from the comment character until the end of the line should be
ignored.

Fixes #10779.

Add tests.

5 years agofs-util: make CHASE_WARN effective with CHASE_NO_AUTOFS 10984/head
Franck Bui [Fri, 30 Nov 2018 14:43:13 +0000 (15:43 +0100)] 
fs-util: make CHASE_WARN effective with CHASE_NO_AUTOFS

This has the side effect to upgrade the log level at which the log is emitted
from debug to warning.

This might be better since after all we didn't apply a tmpfiles.d/ rule and
that actually might end up being problematic eventually.

5 years agofs-util: rename safe_transition() into unsafe_transition()
Franck Bui [Thu, 29 Nov 2018 10:21:12 +0000 (11:21 +0100)] 
fs-util: rename safe_transition() into unsafe_transition()

We're always interested into finding unsafe transitions so let's make the
helper return true when it finds such transitions so we don't need to negate
its results.

No functional changes.

5 years agotmpfiles: use CHASE_WARN in addition to CHASE_SAFE
Franck Bui [Wed, 28 Nov 2018 15:09:16 +0000 (16:09 +0100)] 
tmpfiles: use CHASE_WARN in addition to CHASE_SAFE

and let's emit a more comprehensive warning when an unsafe transition is
encountered.

Before this patch:

 Unsafe symlinks encountered in /run/nrpe, refusing.

After:

 Detected unsafe path transition / → /run during canonicalization of /run/nrpe.

5 years agofs-util: make chase_symlink() returns -ENOLINK when unsafe transitions are met
Franck Bui [Fri, 30 Nov 2018 14:13:44 +0000 (15:13 +0100)] 
fs-util: make chase_symlink() returns -ENOLINK when unsafe transitions are met

We previously returned -EPERM but it can be returned for various other reasons
too.

Let's use -ENOLINK instead as this value shouldn't be used currently. This
allows users of CHASE_SAFE to detect without any ambiguities when unsafe
transitions are encountered by chase_symlinks().

All current users of CHASE_SAFE that explicitly reacted on -EPERM have been
converted to react on -ENOLINK.

5 years agonetworkd: Static neighbor support 10999/head
William A. Kennington III [Thu, 29 Nov 2018 03:00:58 +0000 (19:00 -0800)] 
networkd: Static neighbor support

When using networkd we currently have no way of ensuring that static
neighbor entries are set when our link comes up. This change adds a new
section to the network definition that allows multiple static neighbors
to be set on a link.

5 years agonetworkd: Use only a generic CONFIGURING state
William A. Kennington III [Fri, 30 Nov 2018 23:36:33 +0000 (15:36 -0800)] 
networkd: Use only a generic CONFIGURING state

This allows us to convey that we are performing multiple link
configuration changes in parallel. This is needed to support configuring
neighbors while simultaneously configuring addresses and routes.

5 years agonetworkd: Track address configuration
William A. Kennington III [Fri, 30 Nov 2018 23:54:45 +0000 (15:54 -0800)] 
networkd: Track address configuration

This will be useful to assert that our static route configuration always
happens after address configuration once our individual configure state
goes away.

5 years agotree-wide: drop header for emacs from python scripts 11093/head
Yu Watanabe [Sun, 9 Dec 2018 18:17:33 +0000 (03:17 +0900)] 
tree-wide: drop header for emacs from python scripts

5 years agotools: add one more SPDX license header
Yu Watanabe [Sun, 9 Dec 2018 18:08:52 +0000 (03:08 +0900)] 
tools: add one more SPDX license header

5 years agolgtm: use python3
Yu Watanabe [Sat, 8 Dec 2018 11:51:56 +0000 (20:51 +0900)] 
lgtm: use python3

5 years agotools: drop unused variable
Yu Watanabe [Sat, 8 Dec 2018 10:33:37 +0000 (19:33 +0900)] 
tools: drop unused variable

5 years agohwdb: drop unused imported object
Yu Watanabe [Sat, 8 Dec 2018 10:31:24 +0000 (19:31 +0900)] 
hwdb: drop unused imported object

5 years agohwdb: drop comment
Yu Watanabe [Sat, 8 Dec 2018 10:27:27 +0000 (19:27 +0900)] 
hwdb: drop comment

5 years agoMerge pull request #11095 from evverx/use-systemd-as-pid1-yolo
Evgeny Vereshchagin [Sun, 9 Dec 2018 13:53:03 +0000 (16:53 +0300)] 
Merge pull request #11095 from evverx/use-systemd-as-pid1-yolo

travis: use systemd as PID1 in debian containers

5 years agoMerge pull request #10931 from yuwata/daemon-util
Zbigniew Jędrzejewski-Szmek [Sun, 9 Dec 2018 11:10:57 +0000 (12:10 +0100)] 
Merge pull request #10931 from yuwata/daemon-util

sd-daemon: add notify_on_cleanup() helper function and use it where applicable

5 years agoMerge pull request #11097 from jwrdegoede/hwdb-sensors5
Zbigniew Jędrzejewski-Szmek [Sun, 9 Dec 2018 10:50:39 +0000 (11:50 +0100)] 
Merge pull request #11097 from jwrdegoede/hwdb-sensors5

Hwdb sensors5

5 years agotravis: mount tmpfs on /tmp before running the tests 11095/head
Evgeny Vereshchagin [Sun, 9 Dec 2018 09:29:25 +0000 (10:29 +0100)] 
travis: mount tmpfs on /tmp before running the tests

To judge from https://api.travis-ci.org/v3/job/465547774/log.txt,
overlayfs on Travis CI is having trouble delivering inotify events,
which is why `test-path` and `test-event` are failing there.

5 years agotravis: use systemd as PID1 in debian containers
Evgeny Vereshchagin [Sat, 8 Dec 2018 20:49:52 +0000 (21:49 +0100)] 
travis: use systemd as PID1 in debian containers

Turns out some tests like `test-execute` are tightly coupled with
systemd as PID1 (which should be fixed of course). In the meantime,
let's see how it goes.

5 years agomount-point: honour AT_SYMLINK_FOLLOW correctly
Lennart Poettering [Sat, 8 Dec 2018 19:21:43 +0000 (20:21 +0100)] 
mount-point: honour AT_SYMLINK_FOLLOW correctly

Fixes: #11092
5 years agohwdb: Add accelerometer orientation quirk for the PoV P1005W-232 tablet 11097/head
Hans de Goede [Fri, 7 Dec 2018 19:50:30 +0000 (20:50 +0100)] 
hwdb: Add accelerometer orientation quirk for the PoV P1005W-232 tablet

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
5 years agohwdb: Add accelerometer orientation quirk for the Prowise PT301 tablet
Hans de Goede [Fri, 7 Dec 2018 17:35:51 +0000 (18:35 +0100)] 
hwdb: Add accelerometer orientation quirk for the Prowise PT301 tablet

5 years agocoding style: reduce text width to 109 characters
Zbigniew Jędrzejewski-Szmek [Thu, 6 Dec 2018 14:45:19 +0000 (15:45 +0100)] 
coding style: reduce text width to 109 characters

Patches are shown on github with a fixed width (no matter how wide the window
is). When line numbers are high (we have some files with 5 digit line numbers),
the diff does not fit, and horizontal scrolling must be used when viewing the
patch. This is super annoying. Let's reduce the width a bit. I think 109 is
still very wide, but at least the github issue should be alleviated.

5 years agojournal-remote: define main through macro 10931/head
Yu Watanabe [Mon, 26 Nov 2018 08:51:32 +0000 (17:51 +0900)] 
journal-remote: define main through macro

Also, this fixes memleaks on failure.

5 years agojournal-remote: destroy RemoteServer object by using _cleanup_ attribute
Yu Watanabe [Mon, 26 Nov 2018 08:50:52 +0000 (17:50 +0900)] 
journal-remote: destroy RemoteServer object by using _cleanup_ attribute

5 years agojournal-upload: define main through macro
Yu Watanabe [Mon, 26 Nov 2018 08:35:04 +0000 (17:35 +0900)] 
journal-upload: define main through macro

5 years agojournal-upload: use _cleanup_ attribute to clear uploader
Yu Watanabe [Sun, 25 Nov 2018 20:24:55 +0000 (05:24 +0900)] 
journal-upload: use _cleanup_ attribute to clear uploader

5 years agojournal-gateway: define main through macro
Yu Watanabe [Sun, 25 Nov 2018 20:21:50 +0000 (05:21 +0900)] 
journal-gateway: define main through macro

5 years agojournal-gateway: use _cleanup_ attribute to stop microhttpd daemon
Yu Watanabe [Sun, 25 Nov 2018 20:13:00 +0000 (05:13 +0900)] 
journal-gateway: use _cleanup_ attribute to stop microhttpd daemon

5 years agowait-online: define main through macro
Yu Watanabe [Mon, 26 Nov 2018 07:56:58 +0000 (16:56 +0900)] 
wait-online: define main through macro

5 years agotimesync: define main through macro
Yu Watanabe [Mon, 26 Nov 2018 07:47:07 +0000 (16:47 +0900)] 
timesync: define main through macro

5 years agonetwork: define main through macro
Yu Watanabe [Mon, 26 Nov 2018 07:37:52 +0000 (16:37 +0900)] 
network: define main through macro

5 years agoresolve: define main through macro
Yu Watanabe [Mon, 26 Nov 2018 07:29:02 +0000 (16:29 +0900)] 
resolve: define main through macro

5 years agosd-daemon: add notify_start() and notify_on_cleanup() helper function
Yu Watanabe [Mon, 26 Nov 2018 08:55:56 +0000 (17:55 +0900)] 
sd-daemon: add notify_start() and notify_on_cleanup() helper function

5 years agomeson: rename sd_event_c to sd_event_sources
Yu Watanabe [Mon, 26 Nov 2018 07:18:40 +0000 (16:18 +0900)] 
meson: rename sd_event_c to sd_event_sources

5 years agoMerge pull request #11055 from poettering/resolved-close-fix
Lennart Poettering [Fri, 7 Dec 2018 23:23:43 +0000 (00:23 +0100)] 
Merge pull request #11055 from poettering/resolved-close-fix

a number of resolved fixes

5 years agoMerge pull request #10980 from poettering/mount-no-extras
Lennart Poettering [Fri, 7 Dec 2018 23:23:15 +0000 (00:23 +0100)] 
Merge pull request #10980 from poettering/mount-no-extras

mount and swap improvements

5 years agoswap: always add in extras when we load a swap unit 10980/head
Lennart Poettering [Wed, 28 Nov 2018 19:35:50 +0000 (20:35 +0100)] 
swap: always add in extras when we load a swap unit

Much like for the mount units we need fields such as the slice
initialized by the time we activate the swap, hence when the kernel
let's us know about a new swap that appeared we need to initialize the
slice in any Swap object we allocated for that right-away, even if we
can't read the real unit file for the swap device.

5 years agoswap: drop return value
Lennart Poettering [Wed, 28 Nov 2018 19:24:48 +0000 (20:24 +0100)] 
swap: drop return value

We don't actually return any valid 'r' here, let's explicitly return 0
here hence instead.

5 years agoswap: don't propagate issues with processing /proc/swaps
Lennart Poettering [Wed, 28 Nov 2018 19:24:07 +0000 (20:24 +0100)] 
swap: don't propagate issues with processing /proc/swaps

This follows similar recent changes in mount.c: error should be consider
local, and not be propagated.

5 years agoswap: when loading a unit from /proc/swaps, mark its load state as good
Lennart Poettering [Wed, 28 Nov 2018 19:23:32 +0000 (20:23 +0100)] 
swap: when loading a unit from /proc/swaps, mark its load state as good

This follows similar logic in the mount unit.

5 years agoswap: split out code adding in additional unit props into a function of its own
Lennart Poettering [Wed, 28 Nov 2018 19:22:31 +0000 (20:22 +0100)] 
swap: split out code adding in additional unit props into a function of its own

This adds swap_add_extras() similar to mount_add_extras().

No change in behaviour, just some refactoring.

5 years agoswap: fix misplaced comment
Lennart Poettering [Wed, 28 Nov 2018 19:06:55 +0000 (20:06 +0100)] 
swap: fix misplaced comment

5 years agoswap: flush out state when activating a unit, not when deactivating it
Lennart Poettering [Wed, 28 Nov 2018 19:05:49 +0000 (20:05 +0100)] 
swap: flush out state when activating a unit, not when deactivating it

This is similar to the previous commit which did the same change for
mount units.

5 years agomount: flush out cycle state on DEAD→MOUNTED only, not the other way round
Lennart Poettering [Wed, 28 Nov 2018 19:01:24 +0000 (20:01 +0100)] 
mount: flush out cycle state on DEAD→MOUNTED only, not the other way round

For services (and other units) we generally follow the rule that at the
beginning of each cycle, i.e. when the INACTIVE/FAILED state is left for
ACTIVATING/ACTIVE we flush out various state variables. Mount units
handled this differently so far when the unit state change was effected
outside of systemd: in that case these variables would be flushed out
when going back to INACTIVE/FAILED already.

Let's fix that, and flush out this state always during the activating
transition, not during the deactivating transition.

5 years agomount: replace three closely related mount flags into a proper flags enum
Lennart Poettering [Wed, 28 Nov 2018 18:06:30 +0000 (19:06 +0100)] 
mount: replace three closely related mount flags into a proper flags enum

We pass these flags around, and even created a structure for them. Let's
fix things properly, and make them a flags value of its own.

5 years agomount: strdup() device paths we collect
Lennart Poettering [Wed, 28 Nov 2018 18:02:47 +0000 (19:02 +0100)] 
mount: strdup() device paths we collect

We never know what the changes triggered by mount_set_state() do to the
unit. Let's be safe and copy the device path into our set, so that we
are safe against that.

5 years agomount: when the kernel reports a mount to be established reset all kinds of load...
Lennart Poettering [Wed, 28 Nov 2018 13:58:18 +0000 (14:58 +0100)] 
mount: when the kernel reports a mount to be established reset all kinds of load failures

It doesn't matter what kind of precise failure we had earlier with
loading the unit, let's report that it loaded successfully now, after
all the kernel is an OK source for that, like any other.

5 years agomount: regenerate all deps whenever a mount's parameters changes
Lennart Poettering [Wed, 28 Nov 2018 13:56:27 +0000 (14:56 +0100)] 
mount: regenerate all deps whenever a mount's parameters changes

Whenever we notice a change on an existing /proc/self/mountinfo line,
let's update the deps generated from it. For that, let's flush out the
old deps generated this way, and add in the new ones.

This takes benefit of the fact that today (unlike a comment this patch
removes says) we can remove deps in a somewhat reasonable way.

5 years agomount: when allocating a Mount object based on /proc/self/mountinfo mark it so
Lennart Poettering [Wed, 28 Nov 2018 13:51:04 +0000 (14:51 +0100)] 
mount: when allocating a Mount object based on /proc/self/mountinfo mark it so

Let's set 'from_proc_self_mountinfo' right away, since we know its from
there. This is important so that when the load queue is dispatched (and
thus mount_load() called) this
fact is already known.

5 years agomount: let mount_add_extras() take care of remote-fs.target deps
Lennart Poettering [Wed, 28 Nov 2018 13:42:21 +0000 (14:42 +0100)] 
mount: let mount_add_extras() take care of remote-fs.target deps

In a previous commit we added logic that mount_add_extras() (or more
precisely mount_add_default_dependencies()) adds in dependencies on
remote-fs.target and local-fs.target, hence we can drop this from
mount_setup_new_unit() and let the usual load queue dispatching take
care of this.

5 years agomount: use free_and_strdup() over plain strdup()
Lennart Poettering [Wed, 28 Nov 2018 13:40:56 +0000 (14:40 +0100)] 
mount: use free_and_strdup() over plain strdup()

Let's initialize two fields with free_and_strdup() rather than directly
with strdup(). The fields should not be initialized so far, but it's
still nicer to be prepared for futzre code changes and always free
what's stored before replacing it.

5 years agomount: generate error message matching the error location
Lennart Poettering [Wed, 28 Nov 2018 11:52:12 +0000 (12:52 +0100)] 
mount: generate error message matching the error location

5 years agomount: move allocation of Unit object into mount_setup_new_unit()
Lennart Poettering [Wed, 28 Nov 2018 11:50:01 +0000 (12:50 +0100)] 
mount: move allocation of Unit object into mount_setup_new_unit()

This should encapsulate things in a nicer way.

5 years agomount: add a common helper for filling in info from /proc/self/mountinfo
Lennart Poettering [Wed, 28 Nov 2018 11:46:35 +0000 (12:46 +0100)] 
mount: add a common helper for filling in info from /proc/self/mountinfo

5 years agomount: don't propagate errors from mount_setup_unit() further up
Lennart Poettering [Wed, 28 Nov 2018 11:41:44 +0000 (12:41 +0100)] 
mount: don't propagate errors from mount_setup_unit() further up

If we can't process a specific line in /proc/self/mountinfo we should
log about it (which we do), but this should not affect other lines, nor
further processing of mount units. Let's keep these failures local.

Fixes: #10874
5 years agomount: simplify de-serialization of control PID a bit
Lennart Poettering [Wed, 28 Nov 2018 11:41:14 +0000 (12:41 +0100)] 
mount: simplify de-serialization of control PID a bit

5 years agomount: serialize umount retry counter across reloads/reexec
Lennart Poettering [Wed, 28 Nov 2018 11:40:37 +0000 (12:40 +0100)] 
mount: serialize umount retry counter across reloads/reexec

5 years agomount: make sure mount_add_extras() is always invoked when we load a mount unit
Lennart Poettering [Wed, 28 Nov 2018 11:37:43 +0000 (12:37 +0100)] 
mount: make sure mount_add_extras() is always invoked when we load a mount unit

We need to make sure that the slice property is initialized whenever
mount_load() is invoked, even if we fail to load things properly off
disk. This is important since we generally don't allow changing the
slice after a unit has been started. But given that we must track the
state of external objects with mount units we must hence initialize the
property no matter what.

5 years agomount: document that mount_add_extras() must work with active units, too
Lennart Poettering [Wed, 28 Nov 2018 11:37:23 +0000 (12:37 +0100)] 
mount: document that mount_add_extras() must work with active units, too

5 years agomount: set up local-fs.target/remote-fs.target deps in mount_add_default_dependencies...
Lennart Poettering [Wed, 28 Nov 2018 11:35:37 +0000 (12:35 +0100)] 
mount: set up local-fs.target/remote-fs.target deps in mount_add_default_dependencies() too

This deps are very similar to the -pre deps, hence establish them at the
same place, in particular as they should only be generated if default
deps are on.

This allows us to later on remove similar code that adds in these deps
whenever /proc/self/mountinfo changes.

5 years agomount: remove unnecessary initialization of device_wants_mount and 'if'
Lennart Poettering [Wed, 28 Nov 2018 11:33:45 +0000 (12:33 +0100)] 
mount: remove unnecessary initialization of device_wants_mount and 'if'

5 years agomount: use mfree() where appropriate
Lennart Poettering [Wed, 28 Nov 2018 11:33:21 +0000 (12:33 +0100)] 
mount: use mfree() where appropriate

5 years agomount: rename needs_quota() → mount_needs_quota()
Lennart Poettering [Wed, 28 Nov 2018 11:32:35 +0000 (12:32 +0100)] 
mount: rename needs_quota() → mount_needs_quota()

No change of logic, just some renaming, in order to match more closely
the naming of the other, similar functions.

5 years agomount: merge redundant call mount_needs_network() into mount_is_network()
Lennart Poettering [Wed, 28 Nov 2018 11:32:14 +0000 (12:32 +0100)] 
mount: merge redundant call mount_needs_network() into mount_is_network()

5 years agoresolved: drop unused field structure 11055/head
Lennart Poettering [Tue, 4 Dec 2018 21:18:57 +0000 (22:18 +0100)] 
resolved: drop unused field structure

5 years agoresolved: implicitly disconnect a stream from its server when a stream is closed
Lennart Poettering [Tue, 4 Dec 2018 21:17:49 +0000 (22:17 +0100)] 
resolved: implicitly disconnect a stream from its server when a stream is closed

Previously, the callback function did this, but let's do this in the
caller instead, to make this more robust, and use our new helper
function for it.

5 years agoresolved: add new helper for carefully detach a stream from any server
Lennart Poettering [Tue, 4 Dec 2018 21:15:22 +0000 (22:15 +0100)] 
resolved: add new helper for carefully detach a stream from any server

This adds a helper call for detaching a DnsServer from a DnsStream if
the latter is the "default" stream of the server.

Also, let's unref the stream in dns_stream_stop() rather than
dns_stream_free(): as soon as our stream is disconnected by stopping
there's really no need to keep it as default stream for the server
around.

Since dns_stream_free() calls dns_stream_stop() we can remove it from
the former.

5 years agoresolved: pin stream while calling callbacks for it
Lennart Poettering [Tue, 4 Dec 2018 21:13:39 +0000 (22:13 +0100)] 
resolved: pin stream while calling callbacks for it

These callbacks might unref the stream, but we still have to access it,
let's hence ref it explicitly.

Maybe fixes: #10725

5 years agoresolved: take particular care when detaching DnsServer from its default stream
Lennart Poettering [Tue, 4 Dec 2018 21:09:08 +0000 (22:09 +0100)] 
resolved: take particular care when detaching DnsServer from its default stream

DnsStream and DnsServer have a symbiotic relationship: one DnsStream is
the current "default" stream of the server (and thus reffed by it), but
each stream also refs the server it is connected to. This cyclic
dependency can result in weird situations: when one is
destroyed/unlinked/stopped it needs to unregister itself from the other,
but doing this will trigger unregistration of the other. Hence, let's
make sure we unregister the stream from the server before destroying it,
to break this cycle.

Most likely fixes: #10725

5 years agoresolved: before assuming we have a server, check we are talking DNS and not LLMNR...
Lennart Poettering [Tue, 4 Dec 2018 19:53:14 +0000 (20:53 +0100)] 
resolved: before assuming we have a server, check we are talking DNS and not LLMNR/mDNS

5 years agoresolved: comment headers better
Lennart Poettering [Tue, 4 Dec 2018 19:52:43 +0000 (20:52 +0100)] 
resolved: comment headers better

5 years agoresolved: add small helper to pick DNS port number
Lennart Poettering [Tue, 4 Dec 2018 19:41:06 +0000 (20:41 +0100)] 
resolved: add small helper to pick DNS port number

This shouldn't be hidden in some function argument expression. Let's
make this more explicit by turning this into its own helper function.