1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-27 18:55:40 +03:00
Commit Graph

38713 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
468905cac8 sd-hwdb: use non-atomic reference counters
The sd-hwdb objects cannot be used concurrently from two threads in any
meaningful way, because query and iteration operations modify the object.
Thus atomic reference counts are pointless.
2019-03-04 14:16:39 +01:00
Zbigniew Jędrzejewski-Szmek
42541a71a2 bus: make reference counting non-atomic
We had atomic counters, but all other operations were non-serialized. This
means that concurrent access to the bus object was only safe if _all_ threads
were doing read-only access. Even sending of messages from threads would not be
possible, because after sending of the message we usually want to remove it
from the send queue in the bus object, which would race. Let's just kill this.
2019-03-04 14:16:24 +01:00
Zbigniew Jędrzejewski-Szmek
f68a26221c tests: use the test helpers in more places
This is mostly cosmetic. It makes those test binaries support SYSTEMD_LOG_*
environment variables.
2019-03-04 14:15:38 +01:00
Lennart Poettering
46d4d67d79
Merge pull request #11820 from dm0-/chase
Allow tmpfiles to create files in a root under an unprivileged directory
2019-03-04 13:04:45 +01:00
Lennart Poettering
d8a23f5e4f
Merge pull request #11770 from yuwata/fix-9955
network: rework address pool
2019-03-04 12:11:07 +01:00
Mike Lothian
17f377efd0 login: HyperV requires master-of-seat to be set
v2: Update comment provided by Lennart

Fixes: https://github.com/systemd/systemd/issues/11299
2019-03-04 12:04:53 +01:00
Yu Watanabe
55ac7b6314 fuzz-dhcp6-client: avoid assertion failure on samples which dont fit in pipe
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11584.
2019-03-04 12:04:09 +01:00
Lennart Poettering
965bfcd6b2
Merge pull request #11882 from yuwata/fix-log-syntax
Fix log_syntax()
2019-03-04 11:03:36 +01:00
Yu Watanabe
59c1546b45 test: add tests for log_syntax() 2019-03-04 15:28:32 +09:00
Yu Watanabe
ee96382fdb log: make log_syntax() assign correct errno and show valid error cause 2019-03-04 15:18:06 +09:00
Ben Iofel
892cd2f7ac xbootldr: multiple spaces between keys and values (#11872)
The example below the changed line has multiple spaces between e.g. `title` and `Fedora`
2019-03-03 22:51:22 +01:00
Yu, Li-Yu
abfa5697fa man: flush-caches and reset-server-features are commands for resolvectl (#11877) 2019-03-03 22:50:22 +01:00
Zbigniew Jędrzejewski-Szmek
bdc8f36bfb
Merge pull request #11472 from poettering/sd-bus-ref-tweak
try harder to detect when a bus and its queued messages are fully unreffed and free everything then
2019-03-01 17:52:57 +01:00
Zbigniew Jędrzejewski-Szmek
672d1f57f7
Merge pull request #11863 from poettering/subvol-no-submount
nspawn: don't descend into subvols on --ephemeral
2019-03-01 16:44:40 +01:00
Lennart Poettering
3f2fa83499 man: document that --ephemeral and --template= don't cover submounts
We never made this clear, let's fix that.
2019-03-01 16:25:03 +01:00
Lennart Poettering
d3f3df6199 btrfs: when falling back to plain copy when snapshoting exclude submounts
The subvol snapshot logic doesn't cover sub-mounts either, and it really
shouldn't in the general case, hence let's simply stop at submounts in
all cases, both in the main and in the fall-back codepath.

As discussed here:

https://github.com/systemd/systemd/pull/11243#pullrequestreview-209477230
2019-03-01 16:22:36 +01:00
Zbigniew Jędrzejewski-Szmek
cc5fc36aec
Merge pull request #11243 from poettering/nspawn-root-overlay
add systemd-nspawn --volatile=overlay support, as well as the same for host systems
2019-03-01 16:08:55 +01:00
Lennart Poettering
4b70aedc4a test: add test for new sd-bus refcnt logic 2019-03-01 15:37:39 +01:00
Lennart Poettering
c1757a70ea sd-bus: use "queue" message references for managing r/w message queues in connection objects
Let's make use of the new concept the previous commit added.

See: #4846
2019-03-01 15:37:39 +01:00
Lennart Poettering
1b3f9dd759 bus-message: introduce two kinds of references to bus messages
Before this commit bus messages had a single reference count: when it
reached zero the message would be freed. This simple approach meant a
cyclic dependency was typically seen: a message that was enqueued in a
bus connection object would reference the bus connection object but also
itself be referenced by the bus connection object. So far out strategy
to avoid cases like this was: make sure to process the bus connection
regularly so that messages don#t stay queued, and at exit flush/close
the connection so that the message queued would be emptied, and thus the
cyclic dependencies resolved. Im many cases this isn't done properly
however.

With this change, let's address the issue more systematically: let's
break the reference cycle. Specifically, there are now two types of
references to a bus message:

1. A regular one, which keeps both the message and the bus object it is
   associated with pinned.

2. A "queue" reference, which is weaker: it pins the message, but not
   the bus object it is associated with.

The idea is then that regular user handling uses regular references, but
when a message is enqueued on its connection, then this takes a "queue"
reference instead. This then means that a queued message doesn't imply
the connection itself remains pinned, only regular references to the
connection or a message associated with it do. Thus, if we end up in the
situation where a user allocates a bus and a message and enqueues the
latter in the former and drops all refs to both, then this will detect
this case and free both.

Note that this scheme isn't perfect, it only covers references between
messages and the busses they are associated with. If OTOH a bus message
is enqueued on a different bus than it is associated with cyclic deps
cannot be recognized with this simple algorithm, and thus if you enqueue
a message associated with a bus A on a bus B, and another message
associated with bus B on a bus A, a cyclic ref will be in effect and not
be discovered. However, given that this is an exotic case (though one
that happens, consider systemd-bus-stdio-bridge), it should be OK not to
cover with this, and people have to explicit flush all queues on exit in
that case.

Note that this commit only establishes the separate reference counters
per message. A follow-up commit will start making use of this from the
bus connection object.
2019-03-01 15:37:39 +01:00
Lennart Poettering
b41812d1e3 sd-bus: always go through sd_bus_unref() to free messages
Don't try to be smart, don't bypass the ref counting logic if there's no
real reason to.

This matters if we want to tweak the ref counting logic later.
2019-03-01 15:19:45 +01:00
Lennart Poettering
39feb2ce41 sd-bus: drop two inappropriate empty lines 2019-03-01 15:19:45 +01:00
Lennart Poettering
c0bc4ec5cc sd-bus: make sure dispatch_rqueue() initializes return parameter on all types of success
Let's make sure our own code follows coding style and initializes all
return values on all types of success (and leaves it uninitialized in
all types of failure).
2019-03-01 15:19:45 +01:00
Lennart Poettering
e593b6a87a sd-bus: reorder bus ref and bus message ref handling
Let's always place handling of these references together, so that all
reference counting during allocation is at a single place.
2019-03-01 15:19:45 +01:00
Lennart Poettering
143d4e045a sd-bus: make rqueue/wqueue sizes of type size_t
Let's do this like we usually do and size arrays with size_t.

We already do this for the "allocated" counter correctly, and externally
we expose the queue sizes as uint64_t anyway, hence there's really no
point in usigned "unsigned" internally.
2019-03-01 15:19:45 +01:00
Lennart Poettering
2fe9a10d76 sd-bus: initialize mutex after we allocated the wqueue
That way the mutex doesn't have to be destroyed when we exit early due
to OOM.
2019-03-01 15:19:45 +01:00
Lennart Poettering
8f37636d91 test: fix indenting off by one 2019-03-01 15:19:45 +01:00
Lennart Poettering
d25d289ae2
Merge pull request #11701 from poettering/discover-bls
sd-boot,bootctl,gpt-auto: support Extended Boot Loader Partition
2019-03-01 15:02:09 +01:00
Lennart Poettering
13070a70ef man: document new systemd.volatile=overlay kernel command line option 2019-03-01 14:57:40 +01:00
Lennart Poettering
b23f16283d man: document nspawn's new --volatile=overlay switch 2019-03-01 14:57:40 +01:00
Lennart Poettering
adc6f43b14 copy: don't synthesize a 'user.crtime_usec' xattr on copy unless explicitly requested
Previously, when we'd copy an individual file we'd synthesize a
user.crtime_usec xattr with the source's creation time if we can
determine it. As the creation/birth time was until recently not
queriable form userspace this effectively just propagated the same xattr
on the source to the same xattr on the destination. However, current
kernels now allow to query the birthtime using statx() and we do make
use of that now. Which means that suddenly we started synthesizing these
xattrs much more regularly.

Doing this actually does make sense, but only in very few cases:
not for the typical regular files we copy, but certainly when dealing
with disk images. Hence, let's keep this kind of propagation, but let's
make it a flag and default to off. Then turn it on whenever we deal with
disk images, and leave it off otherwise.

This is particularly relevant as overlayfs combining a real fs, and a
tmpfs on top will result in EOPNOTSUPP when it is attempted to open a
file with xattrs for writing, as tmpfs does not support xattrs, and
hence the copy-up cannot work. Hence, let's avoid synthesizing this
needlessly, to increase compat with overlayfs.
2019-03-01 14:11:07 +01:00
Lennart Poettering
2bef2582a1 gpt-auto-generator: use new /run/systemd/volatile-root symlink as fallback when we otherwise cannot determine root device node 2019-03-01 14:11:07 +01:00
Lennart Poettering
46c82d4956 gpt-auto-generator: rename open_parent() → open_parent_devno() so that we can include fs-util.h later
As that header also defines a function open_parent() which does
something different.
2019-03-01 14:11:07 +01:00
Lennart Poettering
d10b92cb5e volatile-root: export original root 2019-03-01 14:11:07 +01:00
Lennart Poettering
1de7f825d3 volatile-root: add overlay mode for host boots, too 2019-03-01 14:11:07 +01:00
Lennart Poettering
26945d18ac volatile-root: fail if we can't parse specified parameter 2019-03-01 14:11:07 +01:00
Lennart Poettering
85fb5bb2cb volatile-root: add missing logging to volatile-root 2019-03-01 14:11:07 +01:00
Lennart Poettering
68abaa0929 volatile-util: tweak query_volatile_mode() a bit 2019-03-01 14:11:07 +01:00
Lennart Poettering
e5a4bb0d4e nspawn: rework how arg_read_only is initialized in --volatile= mode
Previously, we'd refuse the combination, and claimed we'd imply it, but
actually didn't. Let's allow the combination and imply read-only from
--volatile=, because that's what's documented, what we claim we do, and
what makes sense.
2019-03-01 14:11:07 +01:00
Lennart Poettering
83205269c0 nspawn: refactor how we determine whether it's OK to write to /etc 2019-03-01 14:11:07 +01:00
Lennart Poettering
e50cd82f68 nspawn: no need to make top-level directory a bind mount if we just dissected an image 2019-03-01 14:11:07 +01:00
Lennart Poettering
7d0ecdd62d nspawn: slightly reorder mount logic
Let's first setup the volatile logic, and only then mount secondary
partitions of the image in.
2019-03-01 14:11:07 +01:00
Lennart Poettering
6c610acaaa nspawn: add --volatile=overlay support
Fixes: #11054 #3847
2019-03-01 14:11:06 +01:00
Lennart Poettering
c55d0ae764 nspawn: fix an error path 2019-03-01 14:11:06 +01:00
Lennart Poettering
e5b43a04b6 nspawn: add volatile mode multiplexer call setup_volatile_mode()
Just some refactoring, no change in behaviour.
2019-03-01 14:11:06 +01:00
Lennart Poettering
0646d3c3dd nspawn: explicitly refuse mounts over /
Previously this would fail later on, but let's filter this out at the
time of parsing.
2019-03-01 14:11:06 +01:00
Lennart Poettering
ccc45964a4 update TODO 2019-03-01 12:41:32 +01:00
Lennart Poettering
3da2b703d9 man: document XBOOTLDR partition logic in bootctl's man page 2019-03-01 12:41:32 +01:00
Lennart Poettering
c5fcaed881 man: document XBOOTLDR search logic for sd-boot 2019-03-01 12:41:32 +01:00
Lennart Poettering
aa4c06844d man: extend systemd-gpt-auto-generator with XBOOTLDR info 2019-03-01 12:41:32 +01:00