summaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
2016-05-10Merge pull request #3220 from keszybz/install-fixesLennart Poettering
Fix "preset-all" with dangling symlinks and install-section hint emitted too eagerly
2016-05-09tree-wide: port more code to use ifname_valid()Lennart Poettering
2016-05-08Merge pull request #3202 from poettering/socket-fixesMartin Pitt
don't reopen socket fds when reloading the daemon
2016-05-07core/mount: add helper function for mount statesZbigniew Jędrzejewski-Szmek
2016-05-07Merge pull request #3160 from htejun/cgroup-fixes-rev2Zbigniew Jędrzejewski-Szmek
Cgroup fixes.
2016-05-07Merge pull request #3191 from poettering/cgroups-agent-dgramEvgeny Vereshchagin
core: use an AF_UNIX/SOCK_DGRAM socket for cgroup agent notification
2016-05-06core: dump TriggerLimitIntervalSec and TriggerLimitBurst tooEvgeny Vereshchagin
2016-05-06core: expose TriggerLimitIntervalUSecEvgeny Vereshchagin
Before: $ systemctl show --property TriggerLimitIntervalSec test.socket TriggerLimitIntervalSec=2000000 After: $ systemctl show --property TriggerLimitIntervalUSec test.socket TriggerLimitIntervalUSec=2s
2016-05-06core: update the right mtime after finishing writing of transient units (#3203)Lennart Poettering
Fixes: #3194
2016-05-06core: rework how we flush incoming traffic when a socket unit goes downLennart Poettering
Previously, we'd simply close and reopen the socket file descriptors. This is problematic however, as we won't transition through the SOCKET_CHOWN state then, and thus the file ownership won't be correct for the sockets. Rework the flushing logic, and actually read any queued data from the sockets for flushing, and accept any queued messages and disconnect them.
2016-05-06core: don't implicit open missing socket fds on daemon reloadLennart Poettering
Previously, when the daemon was reloaded and the configuration of a socket unit file was changed so that a different set of socket ports was defined for the socket we'd simply reopen the socket fds not yet open. This is problematic however, as this means the SOCKET_CHOWN state is not run for them, and thus their UID/GID is not corrected. With this change, don't open the missing file descriptors, but log about this issue, and ask the user to restart the socket explicit, to make sure all missing fds are opened. Fixes: #3171
2016-05-06core: split out selinux label retrieval logic into a function of its ownLennart Poettering
This should bring no behavioural change.
2016-05-05core: fix owner user/group output in socket dumpLennart Poettering
The unit file settings are called SocketUser= and SocketGroup= hence name these fields that way in the "systemd-analyze dump" output too. https://github.com/systemd/systemd/issues/3171#issuecomment-216216995
2016-05-05core: change default trigger limits for socket unitsLennart Poettering
Let's lower the default values a bit, and pick different defaults for Accept=yes and Accept=no sockets. Fixes: #3167
2016-05-05tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhereLennart Poettering
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.
2016-05-05core: use an AF_UNIX/SOCK_DGRAM socket for cgroup agent notificationLennart Poettering
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
2016-05-04Merge pull request #3170 from poettering/v230-preparation-fixesLennart Poettering
make virtualization detection quieter, rework unit start limit logic, detect unit file drop-in changes correctly, fix autofs state propagation
2016-05-03Merge pull request #2921 from keszybz/do-not-report-masked-units-as-changedZbigniew Jędrzejewski-Szmek
2016-05-03Revert "Do not report masked units as changed (#2921)"Zbigniew Jędrzejewski-Szmek
This reverts commit 6d10d308c6cd16528ef58fa4f5822aef936862d3. It got squashed by mistake.
2016-05-02Merge pull request #3162 from keszybz/alias-refusalLennart Poettering
Refuse Alias, DefaultInstance, templated units in install (as appropriate)
2016-05-02automount: move resetting of expiry timeout to automount_set_state()Lennart Poettering
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.
2016-05-02automount: rework propagation between automount and mount unitsLennart Poettering
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
2016-05-02core: don't propagate service state to sockets as long as there's still a ↵Lennart Poettering
job for the service queued
2016-05-02automount: add debug message when we get notified about mount state changesLennart Poettering
2016-05-02core: remove duplicate code in automount_update_mount()Lennart Poettering
Also, fix indentation.
2016-05-02core: simplify unit_need_daemon_reload() a bitLennart Poettering
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.
2016-05-02core: fix detection whether per-unit drop-ins changedLennart Poettering
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
2016-05-02core: move enforcement of the start limit into per-unit-type code againLennart Poettering
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.
2016-05-01Move no_instances information to shared/Zbigniew Jędrzejewski-Szmek
This way it can be used in install.c in subsequent commit.
2016-05-01Move no_alias information to shared/Zbigniew Jędrzejewski-Szmek
This way it can be used in install.c in subsequent commit.
2016-04-30Merge pull request #3152 from poettering/aliasfixZbigniew Jędrzejewski-Szmek
Refuse aliases to non-aliasable units in more places Fixes #2730.
2016-04-30core: make unit_has_mask_realized() consider controller enable stateTejun Heo
unit_has_mask_realized() determines whether the specified unit has its cgroups set up properly given the desired target_mask; however, on the unified hierarchy, controllers need to be enabled explicitly for children and the mask of enabled controllers can deviate from target_mask. Only considering target_mask in unit_has_mask_realized() can lead to false positives and skipping enabling the requested controllers. This patch adds unit->cgroup_enabled_mask to track which controllers are enabled and updates unit_has_mask_realized() to also consider enable_mask. Signed-off-by: Tejun Heo <htejun@fb.com>
2016-04-29core: when encountering a symlink alias for non-aliasable units warn nicelyLennart Poettering
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
2016-04-29core: refuse merging on units when the unit type does not support aliasLennart Poettering
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.
2016-04-29core: merge service_connection_unref() into service_close_socket_fd()Lennart Poettering
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.
2016-04-29core: rerun GC logic for a unit that loses a referenceLennart Poettering
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
2016-04-29core: rework socket/service GC logicLennart Poettering
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.
2016-04-29socket: really always close auxiliary fds when closing socket fdsLennart Poettering
2016-04-29core: make sure to close connection fd when we fail to activate a ↵Lennart Poettering
per-connection service Fixes: #2993 #2691
2016-04-29core: minor error path fixLennart Poettering
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.
2016-04-29core: rename StartLimitInterval= to StartLimitIntervalSec=Lennart Poettering
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
2016-04-29core: move start ratelimiting check after condition checksLennart Poettering
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
2016-04-29core: introduce activation rate limiting for socket unitsLennart Poettering
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.
2016-04-29core: Filter by unit name behind the D-Bus, instead on the client side (#3142)kayrus
This commit improves systemd performance on the systems which have thousands of units.
2016-04-29Merge pull request #3069 from Werkov/fix-dependencies-for-bind-mountsLennart Poettering
Always create dependencies for bind mounts
2016-04-26core: set start job timeout from the kernel commandline (#3112)tblume
Add the boot parameter: systemd.default_timeout_start_sec to allow modification of the default start job timeout at boot time.
2016-04-25core: fix description of "resources" service error (#3119)Lennart Poettering
The "resources" error is really just the generic error we return when we hit some kind of error and we have no more appropriate error for the case to return, for example because of some OS error. Hence, reword the explanation and don't claim any relation to resource limits. Admittedly, the "resources" service error is a bit of a misnomer, but I figure it's kind of API now. Fixes: #2716
2016-04-25Always create dependencies for loop device mountsMichal Koutný
In case a file is on a networked filesystem, we may tag the fstab record with _netdev option, however, corrrect dependencies will be created for this mount.
2016-04-25Always create dependencies for bind mountsMichal Koutný
Dependencies were not created for _netdev mountpoints, the reasoning for this is in the commit fc676b00, i.e. to avoid adding dependencies for network mountpoints where What= appears like a path. Thus proposing this semantically more correct condition when dependencies are added for _actual_ bind mounts irrespectively of network flag. Consequently it allows to add _netdev option to bind mounts, which includes them in remote-fs.target, which simplifies configuration.
2016-04-22tree-wide: remove unused variables (#3098)Thomas H. P. Andersen