]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
8 years agojournald: stack allocation cannot fail 3191/head
Lennart Poettering [Thu, 5 May 2016 20:26:09 +0000 (22:26 +0200)] 
journald: stack allocation cannot fail

No need to check whether alloca() failed...

8 years agotree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhere
Lennart Poettering [Thu, 5 May 2016 20:24:36 +0000 (22:24 +0200)] 
tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhere

The macro determines the right length of a AF_UNIX "struct sockaddr_un" to pass to
connect() or bind(). It automatically figures out if the socket refers to an
abstract namespace socket, or a socket in the file system, and properly handles
the full length of the path field.

This macro is not only safer, but also simpler to use, than the usual
offsetof() + strlen() logic.

8 years agocore: use an AF_UNIX/SOCK_DGRAM socket for cgroup agent notification
Lennart Poettering [Wed, 4 May 2016 18:43:23 +0000 (20:43 +0200)] 
core: use an AF_UNIX/SOCK_DGRAM socket for cgroup agent notification

dbus-daemon currently uses a backlog of 30 on its D-bus system bus socket. On
overloaded systems this means that only 30 connections may be queued without
dbus-daemon processing them before further connection attempts fail. Our
cgroups-agent binary so far used D-Bus for its messaging, and hitting this
limit hence may result in us losing cgroup empty messages.

This patch adds a seperate cgroup agent socket of type AF_UNIX/SOCK_DGRAM.
Since sockets of these types need no connection set up, no listen() backlog
applies. Our cgroup-agent binary will hence simply block as long as it can't
enqueue its datagram message, so that we won't lose cgroup empty messages as
likely anymore.

This also rearranges the ordering of the processing of SIGCHLD signals, service
notification messages (sd_notify()...) and the two types of cgroup
notifications (inotify for the unified hierarchy support, and agent for the
classic hierarchy support). We now always process events for these in the
following order:

  1. service notification messages  (SD_EVENT_PRIORITY_NORMAL-7)
  2. SIGCHLD signals (SD_EVENT_PRIORITY_NORMAL-6)
  3. cgroup inotify and cgroup agent (SD_EVENT_PRIORITY_NORMAL-5)

This is because when receiving SIGCHLD we invalidate PID information, which we
need to process the service notification messages which are bound to PIDs.
Hence the order between the first two items. And we want to process SIGCHLD
metadata to detect whether a service is gone, before using cgroup
notifications, to decide when a service is gone, since the former carries more
useful metadata.

Related to this:
https://bugs.freedesktop.org/show_bug.cgi?id=95264
https://github.com/systemd/systemd/issues/1961

8 years agoMerge pull request #3156 from keszybz/duid-settings
Lennart Poettering [Wed, 4 May 2016 09:31:59 +0000 (11:31 +0200)] 
Merge pull request #3156 from keszybz/duid-settings

Rework DUID setting

8 years agotreewide: fix typos (#3187)
Torstein Husebø [Wed, 4 May 2016 09:26:17 +0000 (11:26 +0200)] 
treewide: fix typos (#3187)

8 years agoMerge pull request #3170 from poettering/v230-preparation-fixes
Lennart Poettering [Wed, 4 May 2016 08:46:13 +0000 (10:46 +0200)] 
Merge pull request #3170 from poettering/v230-preparation-fixes

make virtualization detection quieter, rework unit start limit logic, detect unit file drop-in changes correctly, fix autofs state propagation

8 years agotmpfiles: don't set the x bit for volatile system journal when ACL support is enabled...
Franck Bui [Tue, 3 May 2016 23:29:11 +0000 (01:29 +0200)] 
tmpfiles: don't set the x bit for volatile system journal when ACL support is enabled (#3079)

When ACL support is enabled, systemd-tmpfiles-setup service sets the following
ACL entries to the volatile system journal:

   $ getfacl /run/log/journal/*/system.journal
   getfacl: Removing leading '/' from absolute path names
   # file: run/log/journal/xxx/system.journal
   # owner: root
   # group: systemd-journal
   user::rwx
   group::r--
   group:wheel:r-x
   group:adm:r-x
   mask::r-x
   other::---

This patch makes sure that the exec bit is not set anymore for the volatile
system journals.

8 years agoMerge pull request #3185 from NetworkManager/lr/unhappy-trie
Zbigniew Jędrzejewski-Szmek [Tue, 3 May 2016 23:22:22 +0000 (19:22 -0400)] 
Merge pull request #3185 from NetworkManager/lr/unhappy-trie

Fix incorrect string deduplication in udev

8 years agostrbuf: set the proper character when creating new nodes 3185/head
Lubomir Rintel [Tue, 3 May 2016 20:15:49 +0000 (22:15 +0200)] 
strbuf: set the proper character when creating new nodes

Commit 82501b3fc added an early break when a terminal node is found to
incorrect place -- before setting c. This caused trie to be built that
does not correspond to what it points to in buffer, causing incorrect
deduplications:

  # cat /etc/udev/rules.d/99-bug.rules
  ENV{FOO}=="0"
  ENV{xx0}=="BAR"
  ENV{BAZ}=="00"

  # udevadm test
  * RULE /etc/udev/rules.d/99-bug.rules:1, token: 0, count: 2, label: ''
  M ENV match 'FOO' '0'(plain)
  * RULE /etc/udev/rules.d/99-bug.rules:2, token: 2, count: 2, label: ''
  M ENV match 'xx0' 'BAR'(plain)
  * RULE /etc/udev/rules.d/99-bug.rules:3, token: 4, count: 2, label: ''
  M ENV match 'BAZ' 'x0'(plain)
  * END

The addition of "xx0" following "0" will cause a trie like this to be
created:

  c=\0
    c=0 "0"
      c=0 "xx0"  <-- note the c is incorrect here, causing "00" to be
    c=O "FOO"        deduplicated to it
    c=R "BAR"

This in effect caused the usb_modeswitch rule for Huawei modems to never
match and this never be switched to serial mode from mass storage.

8 years agoudev: fix build with DEBUG=1
Lubomir Rintel [Tue, 3 May 2016 20:29:03 +0000 (22:29 +0200)] 
udev: fix build with DEBUG=1

Alternatively, this could perhaps be removed since it was broken for a
long time and noone seemed to care.

But it was helpful for me today.

8 years agoMerge pull request #3183 from crawford/preset-array
Zbigniew Jędrzejewski-Szmek [Tue, 3 May 2016 20:24:09 +0000 (16:24 -0400)] 
Merge pull request #3183 from crawford/preset-array

install: cache the presets before evaluating

8 years agonetworkd: Add support to configure IPv6 preferred lifetime (#3102)
Susant Sahani [Tue, 3 May 2016 19:54:26 +0000 (01:24 +0530)] 
networkd: Add support to configure IPv6 preferred lifetime (#3102)

Closes #2166.

We only allow 0, infinity and forever.
infinity and forever is same.

8 years agoMerge pull request #3132 from ssahani/route-table
Zbigniew Jędrzejewski-Szmek [Tue, 3 May 2016 19:50:21 +0000 (15:50 -0400)] 
Merge pull request #3132 from ssahani/route-table

networkd: add support to set route table

8 years agoMerge pull request #3173 from poettering/dnssec-incapdns-fix
Zbigniew Jędrzejewski-Szmek [Tue, 3 May 2016 18:50:43 +0000 (14:50 -0400)] 
Merge pull request #3173 from poettering/dnssec-incapdns-fix

Dnssec incapdns fix

8 years agoinstall: cache the presets before evaluating 3183/head
Alex Crawford [Thu, 28 Apr 2016 06:59:20 +0000 (23:59 -0700)] 
install: cache the presets before evaluating

The previous implementation traversed the various config directories,
walking the preset files and parsing each line to determine if a service
should be enabled or disabled. It did this for every service which
resulted in many more file operations than neccessary.

This approach parses each of the preset entries into an array which is
then used to check if each service should be enabled or disabled.

8 years agotest-dnssec: drop unused variable
Lennart Poettering [Tue, 12 Apr 2016 11:51:28 +0000 (13:51 +0200)] 
test-dnssec: drop unused variable

(zjs: the tree is now back to 0b2abe0f034f7f2d8654adb11b516d1090ec9a9c.)

8 years agoMerge pull request #2921 from keszybz/do-not-report-masked-units-as-changed
Zbigniew Jędrzejewski-Szmek [Tue, 3 May 2016 18:08:39 +0000 (14:08 -0400)] 
Merge pull request #2921 from keszybz/do-not-report-masked-units-as-changed

8 years agoRevert "Do not report masked units as changed (#2921)"
Zbigniew Jędrzejewski-Szmek [Tue, 3 May 2016 18:08:23 +0000 (14:08 -0400)] 
Revert "Do not report masked units as changed (#2921)"

This reverts commit 6d10d308c6cd16528ef58fa4f5822aef936862d3.

It got squashed by mistake.

8 years agoRevert "test-dnssec: drop unused variable"
Zbigniew Jędrzejewski-Szmek [Tue, 3 May 2016 18:08:16 +0000 (14:08 -0400)] 
Revert "test-dnssec: drop unused variable"

This reverts commit 0bed31c1038c439cc5956fb44017ba28e503095b.

8 years agoMerge pull request #3111 from poettering/nspawn-remove-veth
Zbigniew Jędrzejewski-Szmek [Tue, 3 May 2016 17:49:20 +0000 (13:49 -0400)] 
Merge pull request #3111 from poettering/nspawn-remove-veth

8 years agoRevert "nspawn: explicitly remove veth links after use (#3111)"
Zbigniew Jędrzejewski-Szmek [Tue, 3 May 2016 17:46:40 +0000 (13:46 -0400)] 
Revert "nspawn: explicitly remove veth links after use (#3111)"

This reverts commit d2773e59de3dd970d861e9f996bc48de20ef4314.

Merge got squashed by mistake.

8 years agonetworkd: add support to set route table 3132/head
Susant Sahani [Tue, 3 May 2016 17:48:21 +0000 (23:18 +0530)] 
networkd: add support to set route table

networkd: add support to set route table
1. add support to configure the table id.
   if id is less than 256 we can fit this in the header of route as
   netlink property is a char. But in kernel this proepty is a
   unsigned 32. Hence if greater that 256 add this as RTA_TABLE
attribute.

2. we are not setting the address family now. Now set this property.

8 years agosd-netlink: introduce route attribute set API
Susant Sahani [Tue, 3 May 2016 17:17:48 +0000 (22:47 +0530)] 
sd-netlink: introduce route attribute set API

Introduce
1. sd_rtnl_message_route_set_table to set table ID
2. sd_rtnl_message_route_set_family to set family

Both required to configure route properties.

8 years agosd-netlink: fix sd_netlink_message_append_data
Susant Sahani [Tue, 3 May 2016 17:16:50 +0000 (22:46 +0530)] 
sd-netlink: fix sd_netlink_message_append_data

Also remove the braces add_rtattr not required.

8 years agonetwork: get rid of DUID_TYPE_RAW 3156/head
Zbigniew Jędrzejewski-Szmek [Sun, 1 May 2016 04:59:49 +0000 (00:59 -0400)] 
network: get rid of DUID_TYPE_RAW

It wasn't used for anything after the recent changes.

8 years agoman: add a description of DUIDType and DUIDRawData
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 00:16:55 +0000 (20:16 -0400)] 
man: add a description of DUIDType and DUIDRawData

This is essentially a revert of f38e0cce75ff2ffbd99f7e382ed39c160bb7d799 (which
removed the documentation of DUIDType on purpose). The description is heavily
updated for the new semantics.

This addresses #3127 § 4.

8 years agoman: s/similar/similarly/
Zbigniew Jędrzejewski-Szmek [Fri, 29 Apr 2016 23:08:37 +0000 (19:08 -0400)] 
man: s/similar/similarly/

8 years agotest-networkd-conf: add tests for the parsing functions
Zbigniew Jędrzejewski-Szmek [Fri, 29 Apr 2016 22:46:53 +0000 (18:46 -0400)] 
test-networkd-conf: add tests for the parsing functions

8 years agonetworkd: rework duid_{type,duid_type,duid,duid_len} setting
Zbigniew Jędrzejewski-Szmek [Fri, 29 Apr 2016 03:23:45 +0000 (23:23 -0400)] 
networkd: rework duid_{type,duid_type,duid,duid_len} setting

Separate fields are replaced  with a struct.

Second second duid type field is removed. The first field was used to carry
the result of DUIDType= configuration, and the second was either a copy of
this, or contained the type extracted from DuidRawData. The semantics are changed
so that the type specified in DUIDType is always used. DUIDRawData= no longer
overrides the type setting.

The networkd code is now more constrained than the sd-dhcp code:
DUIDRawData cannot have 0 length, length 0 is treated the same as unsetting.
Likewise, it is not possible to set a DUIDType=0. If it ever becomes necessary
to set type=0 or a zero-length duid, the code can be changed to support that.
Nevertheless, I think that's unlikely.

This addresses #3127 § 1 and 3.

v2:
- rename DUID.duid, DUID.duid_len to DUID.raw_data, DUID.raw_data_len

8 years agodh-dhcp{,6}-client: change the semantics of DUID setting
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 01:18:11 +0000 (21:18 -0400)] 
dh-dhcp{,6}-client: change the semantics of DUID setting

Both versions of the code are changed to allow the caller to override
DUID using simple rules: duid type and value may be specified, in
which case the caller is responsible to providing the contents,
or just duid type may be specified as DUID_TYPE_EN, in which case we
we fill in the values. In the future more support for other types may
be added, e.g. DUID_TYPE_LLT.

There still remains and ugly discrepancy between dhcp4 and dhcp6 code:
dhcp6 has sd_dhcp6_client_set_duid and sd_dhcp6_client_set_iaid and
requires client->state to be DHCP6_STATE_STOPPED, while dhcp4 has
sd_dhcp_client_set_iaid_duid and will reconfigure the client if it
is not stopped. This commit doesn't touch that part.

This addresses #3127 § 2.

8 years agodhcp-identifier: un-inline dhcp_validate_duid_len
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 01:18:02 +0000 (21:18 -0400)] 
dhcp-identifier: un-inline dhcp_validate_duid_len

After all it is used in more than one place and is not that short.
Also tweak the test a bit:
- do not check that duid_len > 0, because we want to allow unknown
  duid types, and there might be some which are fine with 0 length data,
  (also assert should not be called from library code),
- always check that duid_len <= MAX_DUID_LEN, because we could overwrite
  available buffer space otherwise.

8 years agosd-dhcp: change uint8_t *duid to const void*
Zbigniew Jędrzejewski-Szmek [Tue, 3 May 2016 16:08:56 +0000 (12:08 -0400)] 
sd-dhcp: change uint8_t *duid to const void*

8 years agosd-dhcp{,6}-client: use standard indentation for functions args
Zbigniew Jędrzejewski-Szmek [Tue, 3 May 2016 15:52:44 +0000 (11:52 -0400)] 
sd-dhcp{,6}-client: use standard indentation for functions args

8 years agotests: add test for #3166 (#3180)
Evgeny Vereshchagin [Tue, 3 May 2016 09:43:22 +0000 (12:43 +0300)] 
tests: add test for #3166 (#3180)

8 years agoman: rename TriggerLimitIntervalBurst to TriggerLimitBurst (#3181)
Evgeny Vereshchagin [Tue, 3 May 2016 09:33:38 +0000 (12:33 +0300)] 
man: rename TriggerLimitIntervalBurst to TriggerLimitBurst (#3181)

[/etc/systemd/system/test.socket:2] Unknown lvalue 'TriggerLimitIntervalBurst' in section 'Socket'

Follow-up for 8b26cdbd2a94

8 years agolocale: Language fallbacks for fr_(BE|CA|CH|LU) to fr_FR (#3178)
Sylvain Plantefève [Mon, 2 May 2016 23:43:37 +0000 (01:43 +0200)] 
locale: Language fallbacks for fr_(BE|CA|CH|LU) to fr_FR (#3178)

8 years agoMerge pull request #3162 from keszybz/alias-refusal
Lennart Poettering [Mon, 2 May 2016 18:40:54 +0000 (20:40 +0200)] 
Merge pull request #3162 from keszybz/alias-refusal

Refuse Alias, DefaultInstance, templated units in install (as appropriate)

8 years agoMerge pull request #3153 from poettering/async-clone
Zbigniew Jędrzejewski-Szmek [Mon, 2 May 2016 17:56:07 +0000 (13:56 -0400)] 
Merge pull request #3153 from poettering/async-clone

machined: make "clone" asynchronous, and support copy-based fall-back

8 years agoupdate TODO 3173/head
Lennart Poettering [Mon, 2 May 2016 16:35:09 +0000 (18:35 +0200)] 
update TODO

8 years agoresolved: work around broken DNS zones set up by incapdns.net
Lennart Poettering [Mon, 2 May 2016 16:29:28 +0000 (18:29 +0200)] 
resolved: work around broken DNS zones set up by incapdns.net

incapdns.net returns NXDOMAIN for the SOA of the zone itself but is not a
terminal. This is against the specs, but we really should be able to deal with
this.

Previously, when verifying whether an NXDOMAIN response for a SOA/NS lookup is
rightfully unsigned we'd issue a SOA lookup for the parent's domain, to derive
the state from that. If the parent SOA would get an NXDOMAIN, we'd continue
upwards, until we hit a signed top-level domain, which suggests that the domain
actually exists.

With this change whenver we need to authenticate an NXDOMAIN SOA reply, we'll
request the DS RR for the zone first, and use for validation, since that this
must be from the parent's zone, not the incorrect lower zone.

Fixes: #2894
8 years agoautomount: move resetting of expiry timeout to automount_set_state() 3170/head
Lennart Poettering [Mon, 2 May 2016 15:12:35 +0000 (17:12 +0200)] 
automount: move resetting of expiry timeout to automount_set_state()

that way we can be sure that there's no expiry timeout in place at any time
when we aren't in the RUNNING state.

8 years agoautomount: rework propagation between automount and mount units
Lennart Poettering [Mon, 2 May 2016 14:51:45 +0000 (16:51 +0200)] 
automount: rework propagation between automount and mount units

Port the progagation logic to the generic Unit->trigger_notify() callback logic
in the unit vtable, that is called for a unit not only when the triggered unit
of it changes state but also when a job for that unit finishes. This, firstly
allows us to make the code a bit cleaner and more generic, but more
importantly, allows us to notice correctly when a mount job fails, and
propagate that back to autofs client processes.

Fixes: #2181
8 years agocore: don't propagate service state to sockets as long as there's still a job for...
Lennart Poettering [Mon, 2 May 2016 14:41:41 +0000 (16:41 +0200)] 
core: don't propagate service state to sockets as long as there's still a job for the service queued

8 years agofstab-generator: add newline before we start a new unit file section
Lennart Poettering [Mon, 2 May 2016 14:02:02 +0000 (16:02 +0200)] 
fstab-generator: add newline before we start a new unit file section

We already did this for the [Mount] section, let's do the same for [Automount].

8 years agoautomount: add debug message when we get notified about mount state changes
Lennart Poettering [Mon, 2 May 2016 14:01:39 +0000 (16:01 +0200)] 
automount: add debug message when we get notified about mount state changes

8 years agocore: remove duplicate code in automount_update_mount()
Lennart Poettering [Mon, 2 May 2016 14:01:16 +0000 (16:01 +0200)] 
core: remove duplicate code in automount_update_mount()

Also, fix indentation.

8 years agocore: simplify unit_need_daemon_reload() a bit
Lennart Poettering [Mon, 2 May 2016 13:07:40 +0000 (15:07 +0200)] 
core: simplify unit_need_daemon_reload() a bit

And let's make it more accurate: if we have acquire the list of unit drop-ins,
then let's do a full comparison against the old list we already have, and if
things differ in any way, we know we have to reload.

This makes sure we detect changes to drop-in directories in more cases.

8 years agocore: fix detection whether per-unit drop-ins changed
Lennart Poettering [Mon, 2 May 2016 12:50:27 +0000 (14:50 +0200)] 
core: fix detection whether per-unit drop-ins changed

This fixes fall-out from 6d10d308c6cd16528ef58fa4f5822aef936862d3.

Until that commit, do determine whether a daemon reload was required we compare
the mtime of the main unit file we loaded with the mtime of it on disk for
equality, but for drop-ins we only stored the newest mtime of all of them and
then did a "newer-than" comparison. This was brokeni with the above commit,
when all checks where changed to be for equality.

With this change all checks are now done as "newer-than", fixing the drop-in
mtime case. Strictly speaking this will not detect a number of changes that the
code before above commit detected, but given that the mtime is unlikely to go
backwards, and this is just intended to be a helpful hint anyway, this looks OK
in order to keep things simple.

Fixes: #3123
8 years agocore: move enforcement of the start limit into per-unit-type code again
Lennart Poettering [Mon, 2 May 2016 11:01:26 +0000 (13:01 +0200)] 
core: move enforcement of the start limit into per-unit-type code again

Let's move the enforcement of the per-unit start limit from unit.c into the
type-specific files again. For unit types that know a concept of "result" codes
this allows us to hook up the start limit condition to it with an explicit
result code. Also, this makes sure that the state checks in clal like
service_start() may be done before the start limit is checked, as the start
limit really should be checked last, right before everything has been verified
to be in order.

The generic start limit logic is left in unit.c, but the invocation of it is
moved into the per-type files, in the various xyz_start() functions, so that
they may place the check at the right location.

Note that this change drops the enforcement entirely from device, slice, target
and scope units, since these unit types generally may not fail activation, or
may only be activated a single time. This is also documented now.

Note that restores the "start-limit-hit" result code that existed before
6bf0f408e4833152197fb38fb10a9989c89f3a59 already in the service code. However,
it's not introduced for all units that have a result code concept.

Fixes #3166.

8 years agoutil: don't dump /proc/cpuinfo contents in debug info
Lennart Poettering [Mon, 2 May 2016 09:26:40 +0000 (11:26 +0200)] 
util: don't dump /proc/cpuinfo contents in debug info

This is hardly useful, it's trivial for developers to get that info by running
cat /proc/cpuinfo.

Fixes #3155

8 years agoman: slightly extend the machinectl clone documentation 3153/head
Lennart Poettering [Mon, 2 May 2016 09:14:46 +0000 (11:14 +0200)] 
man: slightly extend the machinectl clone documentation

8 years agominor CODING_STYLE clarification
Lennart Poettering [Mon, 2 May 2016 09:14:13 +0000 (11:14 +0200)] 
minor CODING_STYLE clarification

8 years agoupdate TODO
Lennart Poettering [Fri, 29 Apr 2016 18:35:14 +0000 (20:35 +0200)] 
update TODO

8 years agomachinectl: since clone/remove/copy verbs are possibly slow, turn off bus call timeout
Lennart Poettering [Fri, 29 Apr 2016 18:57:39 +0000 (20:57 +0200)] 
machinectl: since clone/remove/copy verbs are possibly slow, turn off bus call timeout

By default we timeout all bus calls, but if we know that these bus calls might
be slow, let's explicitly turn the timeouts off.

8 years agomachined: rework copy-from/copy-to operation to use generic Operation object
Lennart Poettering [Fri, 29 Apr 2016 18:32:56 +0000 (20:32 +0200)] 
machined: rework copy-from/copy-to operation to use generic Operation object

With this all potentially slow operations are done out-of-process,
asynchronously, using the same "Operation" object.

8 years agomachined: also make image removal operation asynchronous
Lennart Poettering [Fri, 29 Apr 2016 18:17:55 +0000 (20:17 +0200)] 
machined: also make image removal operation asynchronous

If we remove a directory image (i.e. not a btrfs snapshot) then things might
get quite expensive, hence run this asynchronous in a forked off process, too.

8 years agomachined: support non-btrfs file systems with "machinectl clone"
Lennart Poettering [Fri, 29 Apr 2016 18:06:20 +0000 (20:06 +0200)] 
machined: support non-btrfs file systems with "machinectl clone"

Fall back to a normal copy operation when the backing file system isn't btrfs,
and hence doesn't support cheap snapshotting. Of course, this will be slow, but
given that the execution is asynchronous now, this should be OK.

Fixes: #1308
8 years agotree-wide: fix invocations of chattr_path()
Lennart Poettering [Fri, 29 Apr 2016 18:05:44 +0000 (20:05 +0200)] 
tree-wide: fix invocations of chattr_path()

chattr_path() takes two bitmasks, and no booleans. Fix the various invocations
to do this properly.

8 years agocopy: adjust directory times after writing to the directory
Lennart Poettering [Fri, 29 Apr 2016 17:44:59 +0000 (19:44 +0200)] 
copy: adjust directory times after writing to the directory

When recursively copying a directory tree, fix up the file times after having
created all contents in it, so that our changes don't end up altering any of
the directory times.

8 years agocopy: return the right error when we can't open a file
Lennart Poettering [Fri, 29 Apr 2016 17:42:07 +0000 (19:42 +0200)] 
copy: return the right error when we can't open a file

8 years agoimage: enable btrfs quotas on the clone destination, not the source
Lennart Poettering [Fri, 29 Apr 2016 17:26:54 +0000 (19:26 +0200)] 
image: enable btrfs quotas on the clone destination, not the source

8 years agoutil: rework sigkill_wait() to not require pid_t pointer
Lennart Poettering [Fri, 29 Apr 2016 17:23:23 +0000 (19:23 +0200)] 
util: rework sigkill_wait() to not require pid_t pointer

Let's make sigkill_wait() take a normal pid_t, and add sigkill_waitp() that
takes a pointer (which is useful for usage in _cleanup_), following the usual
logic we have for this.

8 years agomachined: run clone operation asynchronously in the background
Lennart Poettering [Fri, 29 Apr 2016 17:14:52 +0000 (19:14 +0200)] 
machined: run clone operation asynchronously in the background

Cloning an image can be slow, if the image is not on a btrfs subvolume, hence
let's make sure we do this asynchronously in a child process, so that machined
isn't blocked as long as we process the client request.

This adds a new, generic "Operation" object to machined, that is used to track
these kind of background processes.

This is inspired by the MachineOperation object that already exists to make
copy operations asynchronous. A later patch will rework the MachineOperation
logic to use the generic Operation instead.

8 years agotests: add test for https://github.com/systemd/systemd/issues/2467 (#3168)
Evgeny Vereshchagin [Mon, 2 May 2016 08:57:19 +0000 (11:57 +0300)] 
tests: add test for https://github.com/systemd/systemd/issues/2467 (#3168)

8 years agoshared/install: refuse template files for non-templateable units 3162/head
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 21:52:19 +0000 (17:52 -0400)] 
shared/install: refuse template files for non-templateable units

$ systemctl --root=/ enable templated@bar.mount
Unit type mount cannot be templated.
Failed to enable: Invalid argument.

8 years agoshared/install: warn about DefaultInstance in non-template units
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 21:08:38 +0000 (17:08 -0400)] 
shared/install: warn about DefaultInstance in non-template units

[/etc/systemd/system/mnt-test.mount:6] DefaultInstance only makes sense for template units, ignoring.

8 years agoMove no_instances information to shared/
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 22:34:13 +0000 (18:34 -0400)] 
Move no_instances information to shared/

This way it can be used in install.c in subsequent commit.

8 years agoshared/install: ignore Alias in [Install] of units which don't allow aliases
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 20:54:37 +0000 (16:54 -0400)] 
shared/install: ignore Alias in [Install] of units which don't allow aliases

A downside is that a warning about missing [Install] is printed:
$ systemctl --root=/ enable mnt-test.mount
[/etc/systemd/system/mnt-test.mount:5] Aliases are not allowed for mount units, ignoring.
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
   instance name specified.

That's a bit misleading, but I don't see an easy way to fix this. But
the situation is similar for many other parsing errors, so maybe that's
OK.

8 years agoMove no_alias information to shared/
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 20:21:41 +0000 (16:21 -0400)] 
Move no_alias information to shared/

This way it can be used in install.c in subsequent commit.

8 years agoMerge pull request #3165 from evverx/tests-cleanups
Lennart Poettering [Sun, 1 May 2016 19:06:41 +0000 (21:06 +0200)] 
Merge pull request #3165 from evverx/tests-cleanups

tests,build-sys: some cleanups

8 years agocatalog: rename RateLimitInterval= to RateLimitIntervalSec= 3165/head
Evgeny Vereshchagin [Sun, 1 May 2016 17:15:21 +0000 (17:15 +0000)] 
catalog: rename RateLimitInterval= to RateLimitIntervalSec=

Follow-up for f0367da7d1a61

Closes #3158

8 years agotest: ensure presets are evaluated in order
Alex Crawford [Sun, 1 May 2016 16:32:17 +0000 (09:32 -0700)] 
test: ensure presets are evaluated in order

This tests to make sure that preset patterns are checked in the order
they were declared. Both "prefix-1.service" and "prefix-2.service" match
against two rules: their exact name (which enables the service) and
"prefix-*.service" (which disables the service). Because of the
ordering, only "prefix-1.service" should be enabled.

8 years agotests: use symlink to Makefile
Evgeny Vereshchagin [Sun, 1 May 2016 16:31:36 +0000 (16:31 +0000)] 
tests: use symlink to Makefile

8 years agobuild-sys: add TEST-0[89]-* to dist
Evgeny Vereshchagin [Sun, 1 May 2016 16:30:53 +0000 (16:30 +0000)] 
build-sys: add TEST-0[89]-* to dist

Follow-up for 91f9f8f1bae and 4f4d6ee4be1c

8 years agobuild-sys: allow references to adm group to be omitted (#3150)
Franck Bui [Sun, 1 May 2016 04:02:17 +0000 (06:02 +0200)] 
build-sys: allow references to adm group to be omitted (#3150)

8 years agoMerge pull request #3152 from poettering/aliasfix
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 22:00:46 +0000 (18:00 -0400)] 
Merge pull request #3152 from poettering/aliasfix

Refuse aliases to non-aliasable units in more places

Fixes #2730.

8 years agoarchitecture: Add nios2 (#3159)
Zbigniew Jędrzejewski-Szmek [Sat, 30 Apr 2016 21:07:34 +0000 (17:07 -0400)] 
architecture: Add nios2 (#3159)

Add nios2 architecture support. The nios2 is a softcore by Altera.

8 years agonetworkd: rework headers to avoid circular includes
Zbigniew Jędrzejewski-Szmek [Fri, 29 Apr 2016 02:52:04 +0000 (22:52 -0400)] 
networkd: rework headers to avoid circular includes

Header files were organized in a way where the includer would add various
typedefs used by the includee before including it, resulting in a tangled
web of dependencies between files.

Replace this with the following logic:

          networkd.h
         /          \
networkd-link.h      \
networkd-ipv4ll.h--\__\
networkd-fdb.h         \
networkd-network.h    netword-netdev-*.h
networkd-route.h           \
                      networkd-netdev.h

If a pointer to a structure defined in a different header file is needed,
use a typedef line instead of including the whole header.

8 years agoMerge pull request #3151 from keszybz/pr3149-2
Zbigniew Jędrzejewski-Szmek [Fri, 29 Apr 2016 18:27:23 +0000 (14:27 -0400)] 
Merge pull request #3151 from keszybz/pr3149-2

 Assorted fixes #3149 + one commit tacked on top

8 years agoMerge pull request #3148 from poettering/trigger
Zbigniew Jędrzejewski-Szmek [Fri, 29 Apr 2016 18:27:04 +0000 (14:27 -0400)] 
Merge pull request #3148 from poettering/trigger

core: introduce activation rate limit and parse nice levels and close sockets properly

8 years agoman: document that some unit types do not support unit aliases via symlinks 3152/head
Lennart Poettering [Fri, 29 Apr 2016 15:48:07 +0000 (17:48 +0200)] 
man: document that some unit types do not support unit aliases via symlinks

8 years agocore: when encountering a symlink alias for non-aliasable units warn nicely
Lennart Poettering [Fri, 29 Apr 2016 15:37:33 +0000 (17:37 +0200)] 
core: when encountering a symlink alias for non-aliasable units warn nicely

If the user defines a symlink alias for a unit whose type does not support
aliasing, detect this early and print a nice warning.

Fixe: #2730

8 years agohashmap: optimize set_put_strdup() a bit
Lennart Poettering [Fri, 29 Apr 2016 15:33:29 +0000 (17:33 +0200)] 
hashmap: optimize set_put_strdup() a bit

Hashing should be quicker than allocating, hence let's first check if the
string already exists and only then allocate a new copy for it.

8 years agocore: refuse merging on units when the unit type does not support alias
Lennart Poettering [Fri, 29 Apr 2016 15:31:02 +0000 (17:31 +0200)] 
core: refuse merging on units when the unit type does not support alias

The concept of merging units exists so that we can create Unit objects for a
number of names early, and then load them only later, possibly merging units
which then turn out to be symlinked to other names. This of course only makes
sense for unit types where multiple names per unit are supported. For all
others, let's refuse the merge operation early.

8 years agoupdate TODO 3148/head
Lennart Poettering [Thu, 28 Apr 2016 19:02:11 +0000 (21:02 +0200)] 
update TODO

8 years agocore: merge service_connection_unref() into service_close_socket_fd()
Lennart Poettering [Fri, 29 Apr 2016 09:36:00 +0000 (11:36 +0200)] 
core: merge service_connection_unref() into service_close_socket_fd()

We always call one after the other anyway, and this way service_set_socket_fd()
and service_close_socket_fd() nicely match each other as one undoes the effect
of the other.

8 years agocore: rerun GC logic for a unit that loses a reference
Lennart Poettering [Fri, 29 Apr 2016 09:18:53 +0000 (11:18 +0200)] 
core: rerun GC logic for a unit that loses a reference

Let's make sure when we drop a reference to a unit, that we run the GC queue on
it again.

This (together with the previous commit) should deal with the GC issues pointed
out in:

https://github.com/systemd/systemd/pull/2993#issuecomment-215331189

8 years agocore: rework socket/service GC logic
Lennart Poettering [Fri, 29 Apr 2016 09:14:03 +0000 (11:14 +0200)] 
core: rework socket/service GC logic

There's no need to set the no_gc bit for service units that socket units
prepare, as we always keep a proper reference (as maintained by unit_ref_set())
on them, and such references are honoured by the GC logic anyway. Moreover,
explicitly setting the no_gc bit is problematic if the socket gets GC'ed for a
reason, as the service might then leak with the bit set.

8 years agohwdb: add missing newline so the hwdb buils correctly again
Lennart Poettering [Fri, 29 Apr 2016 08:46:56 +0000 (10:46 +0200)] 
hwdb: add missing newline so the hwdb buils correctly again

8 years agosocket: really always close auxiliary fds when closing socket fds
Lennart Poettering [Thu, 28 Apr 2016 19:47:20 +0000 (21:47 +0200)] 
socket: really always close auxiliary fds when closing socket fds

8 years agocore: make parsing of RLIMIT_NICE aware of actual nice levels
Lennart Poettering [Thu, 28 Apr 2016 19:00:28 +0000 (21:00 +0200)] 
core: make parsing of RLIMIT_NICE aware of actual nice levels

8 years agocore: make sure to close connection fd when we fail to activate a per-connection...
Lennart Poettering [Thu, 28 Apr 2016 15:09:50 +0000 (17:09 +0200)] 
core: make sure to close connection fd when we fail to activate a per-connection service

Fixes: #2993 #2691
8 years agocore: minor error path fix
Lennart Poettering [Thu, 28 Apr 2016 14:51:30 +0000 (16:51 +0200)] 
core: minor error path fix

In service_set_socket_fd(), let's make sure that if we can't add the requested
dependencies we take no possession of the passed connection fd.

This way, we follow the strict rule: we take possession of the passed fd on
success, but on failure we don't, and the fd remains in possession of the
caller.

8 years agocore: rename StartLimitInterval= to StartLimitIntervalSec=
Lennart Poettering [Tue, 26 Apr 2016 18:46:20 +0000 (20:46 +0200)] 
core: rename StartLimitInterval= to StartLimitIntervalSec=

We generally follow the rule that for time settings we suffix the setting name
with "Sec" to indicate the default unit if none is specified. The only
exception was the rate limiting interval settings. Fix this, and keep the old
names for compatibility.

Do the same for journald's RateLimitInterval= setting

8 years agocore: move start ratelimiting check after condition checks
Lennart Poettering [Tue, 26 Apr 2016 18:34:33 +0000 (20:34 +0200)] 
core: move start ratelimiting check after condition checks

With #2564 unit start rate limiting was moved from after the condition checks
are to before they are made, in an attempt to fix #2467. This however resulted
in #2684. However, with a previous commit a concept of per socket unit trigger
rate limiting has been added, to fix #2467 more comprehensively, hence the
start limit can be moved after the condition checks again, thus fixing #2684.

Fixes: #2684
8 years agocore: introduce activation rate limiting for socket units
Lennart Poettering [Tue, 26 Apr 2016 18:26:15 +0000 (20:26 +0200)] 
core: introduce activation rate limiting for socket units

This adds two new settings TriggerLimitIntervalSec= and TriggerLimitBurst= that
define a rate limit for activation of socket units. When the limit is hit, the
socket is is put into a failure mode. This is an alternative fix for #2467,
since the original fix resulted in issue #2684.

In a later commit the StartLimitInterval=/StartLimitBurst= rate limiter will be
changed to be applied after any start conditions checks are made. This way,
there are two separate rate limiters enforced: one at triggering time, before
any jobs are queued with this patch, as well as the start limit that is moved
again to be run immediately before the unit is activated. Condition checks are
done in between the two, and thus no longer affect the start limit.

8 years agobuild-sys: improve compat with older kernel headers
Lennart Poettering [Wed, 27 Apr 2016 07:44:49 +0000 (09:44 +0200)] 
build-sys: improve compat with older kernel headers

In 4.2 kernel headers, some netlink defines are missing that we need. missing.h
already can add them in, but currently makes this dependent on a definition
that these kernels already have. Change the check hence to check for the newest
definition in the table, so that the whole bunch of definitions as added in on
all kernels lacking this.

8 years agopath-util: also support ".old" and ".new" suffixes and recommend them 3151/head
Zbigniew Jędrzejewski-Szmek [Fri, 29 Apr 2016 14:17:43 +0000 (10:17 -0400)] 
path-util: also support ".old" and ".new" suffixes and recommend them

~ suffix works fine, but looks to much like it the file is supposed to be
automatically cleaned up. For new versions of configuration files installers
might want to using something that looks more permanent like foobar.new.
So let's add treat ".old" and ".new" as special.

Update test to match.

8 years agocore: Filter by unit name behind the D-Bus, instead on the client side (#3142)
kayrus [Fri, 29 Apr 2016 13:59:51 +0000 (15:59 +0200)] 
core: Filter by unit name behind the D-Bus, instead on the client side (#3142)

This commit improves systemd performance on the systems which have
thousands of units.

8 years agoMerge pull request #3126 from poettering/small-fixes
Zbigniew Jędrzejewski-Szmek [Fri, 29 Apr 2016 13:16:45 +0000 (09:16 -0400)] 
Merge pull request #3126 from poettering/small-fixes

fsync directory when creating or rotating journal files and other small fixes,
most importantly for the DHCP DUID code.