summaryrefslogtreecommitdiff
path: root/src/core/mount.c
AgeCommit message (Collapse)Author
2014-03-24sd-event: rework API to support CLOCK_REALTIME_ALARM and ↵Lennart Poettering
CLOCK_BOOTTIME_ALARM, too
2014-03-19core: rework context initialization/destruction logicLennart Poettering
Let's automatically initialize the kill, exec and cgroup contexts of the various unit types when the object is constructed, instead of invididually in type-specific code. Also, when PrivateDevices= is set, set DevicePolicy= to closed.
2014-03-07fstab-generator: merge /proc/cmdline parsing loops into oneLennart Poettering
2014-03-03core: introduce new RuntimeDirectory= and RuntimeDirectoryMode= unit settingsLennart Poettering
As discussed on the ML these are useful to manage runtime directories below /run for services.
2014-02-26mount: don't fire PropertiesChanged signals for mounts that are stoppedLennart Poettering
2014-02-26mount: don't send out PropertiesChanged message if actually nothing got changedLennart Poettering
2014-02-26mount: minor modernizationLennart Poettering
2014-02-24core: add global settings for enabling CPUAccounting=, MemoryAccounting=, ↵Lennart Poettering
BlockIOAccounting= for all units at once
2014-02-20api: in constructor function calls, always put the returned object pointer ↵Lennart Poettering
first (or second) Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
2014-01-29core: make sure to always go through both SIGTERM and SIGKILL states of unitsLennart Poettering
Given that we now have KillMode=mixed where SIGTERM might kill a smaller set than SIGKILL we need to make sure to always go explicitly throught the SIGKILL state to get the right end result.
2014-01-27core: add function to tell when job will time outZbigniew Jędrzejewski-Szmek
Things will continue when either the job timeout or the unit timeout is reached. Add functionality to access that info.
2014-01-07mount: don't creat local-fs.target links for mount units when runnin in user ↵Lennart Poettering
mode
2014-01-02Use format patterns for usec_t, pid_t, nsec_t, usec_tZbigniew Jędrzejewski-Szmek
It is nicer to predefine patterns using configure time check instead of using casts everywhere. Since we do not need to use any flags, include "%" in the format instead of excluding it like PRI* macros.
2013-12-22sd-daemon: introduce sd_watchdog_enabled() for parsing $WATCHDOG_USECLennart Poettering
Also, introduce a new environment variable named $WATCHDOG_PID which cotnains the PID of the process that is supposed to send the keep-alive events. This is similar how $LISTEN_FDS and $LISTEN_PID work together, and protects against confusing processes further down the process tree due to inherited environment.
2013-12-22core: no need to list properties for PropertiesChanged messages anymoreLennart Poettering
Since the vtable includes this information anyway, let's just use that
2013-12-02bus: add .busname unit type to implement kdbus-style bus activationLennart Poettering
2013-11-27service: add the ability for units to join other unit's PrivateNetwork= and ↵Lennart Poettering
PrivateTmp= namespaces
2013-11-25core: set some event source priorities to enforce dispatching orderLennart Poettering
2013-11-25swap: split state machine state ACTIVATING into twoLennart Poettering
We expect the event on /proc/swaps before we expect the SIGCHILD, reflect this in the state machine.
2013-11-20core: convert PID 1 to libsystemd-busLennart Poettering
This patch converts PID 1 to libsystemd-bus and thus drops the dependency on libdbus. The only remaining code using libdbus is a test case that validates our bus marshalling against libdbus' marshalling, and this dependency can be turned off. This patch also adds a couple of things to libsystem-bus, that are necessary to make the port work: - Synthesizing of "Disconnected" messages when bus connections are severed. - Support for attaching multiple vtables for the same interface on the same path. This patch also fixes the SetDefaultTarget() and GetDefaultTarget() bus calls which used an inappropriate signature. As a side effect we will now generate PropertiesChanged messages which carry property contents, rather than just invalidation information.
2013-11-05Configurable Timeouts/Restarts default valuesOleksii Shevchuk
https://bugs.freedesktop.org/show_bug.cgi?id=71132 Patch adds DefaultTimeoutStartSec, DefaultTimeoutStopSec, DefaultRestartSec configuration options to manager configuration file.
2013-10-19mount/service: drop FsckPassNo supportTom Gundersen
We now treat passno as boleans in the generators, and don't need this any more. fsck itself is able to sequentialize checks on the same local media, so in the common case the ordering is redundant. It is still possible to force an order by using .d fragments, in case that is desired.
2013-10-05core: do not add "what" to RequiresMountsFor for network mountsZbigniew Jędrzejewski-Szmek
For cifs mount like //server/share, we would get RequiresMountsFor=/server/share, which probably isn't harmful, but quite confusing. Unfortunately a bunch of static functions had to be moved up, but patch is really one line.
2013-10-04mount: check for NULL before reading pm->whatDave Reisner
Since a57f7e2c828b85, a mount unit with garbage in it would cause systemd to crash on loading it. ref: https://bugs.freedesktop.org/show_bug.cgi?id=70148
2013-10-03systemd: order remote mounts from mountinfo before remote-fs.targetZbigniew Jędrzejewski-Szmek
Usually the network is stopped before filesystems are umounted. Ordering network filesystems before remote-fs.target means that their unmounting will be performed earlier, and can terminate sucessfully. https://bugs.freedesktop.org/show_bug.cgi?id=70002
2013-09-26core: rework how we match mount units against each otherLennart Poettering
Previously to automatically create dependencies between mount units we matched every mount unit agains all others resulting in O(n^2) complexity. On setups with large amounts of mount units this might make things slow. This change replaces the matching code to use a hashtable that is keyed by a path prefix, and points to a set of units that require that path to be around. When a new mount unit is installed it is hence sufficient to simply look up this set of units via its own file system paths to know which units to order after itself. This patch also changes all unit types to only create automatic mount dependencies via the RequiresMountsFor= logic, and this is exposed to the outside to make things more transparent. With this change we still have some O(n) complexities in place when handling mounts, but that's currently unavoidable due to kernel APIs, and still substantially better than O(n^2) as before. https://bugs.freedesktop.org/show_bug.cgi?id=69740
2013-09-25cgroup: if we do a cgroup operation then do something on all supported ↵Lennart Poettering
controllers Previously we did operations like attach, trim or migrate only on the controllers that were enabled for a specific unit. With this changes we will now do them for all supproted controllers, and fall back to all possible prefix paths if the specified paths do not exist. This fixes issues if a controller is being disabled for a unit where it was previously enabled, and makes sure that all processes stay as "far down" the tree as groups exist.
2013-09-11mount: filesystems mounted in the initrd should not conflict with ↵Tom Gundersen
umount.target in the real root These mounts should be kept around and unmounted in the shutdown ramfs. Currently, we will still attempt to umount these in the final kill spree, but we should consider avoiding that too. Also, the should_umount function should be generalised and put into util.c or something like that, but we are still discussing precisely how.
2013-09-11mount: move device links handling from generatorTom Gundersen
This makes mount units work like swap units: when the backing device appears the mount unit will be started. v2: the device should want the mount unconditionally, not only for DefaultDependencies=yes
2013-07-18mount: also exclude /usr from unmount at shutdownLennart Poettering
2013-07-04core/mount.c:mount_dump(): don't segfault, if mount is not mounted anymoreHarald Hoyer
Don't segfault, if m->from_proc_self_mountinfo and m->from_fragment is false. https://bugzilla.redhat.com/show_bug.cgi?id=957783#c9
2013-06-28core: add transient unitsLennart Poettering
Transient units can be created via the bus API. They are configured via the method call parameters rather than on-disk files. They are subject to normal GC. Transient units currently may only be created for services (however, we will extend this), and currently only ExecStart= and the cgroup parameters can be configured (also to be extended). Transient units require a unique name, that previously had no configuration file on disk. A tool systemd-run is added that makes use of this functionality to run arbitrary command lines as transient services: $ systemd-run /bin/ping www.heise.de Will cause systemd to create a new transient service and run ping in it.
2013-06-27dbus: hookup runtime property changes for mouns, services, sockets, swaps tooLennart Poettering
2013-06-27core: general cgroup reworkLennart Poettering
Replace the very generic cgroup hookup with a much simpler one. With this change only the high-level cgroup settings remain, the ability to set arbitrary cgroup attributes is removed, so is support for adding units to arbitrary cgroup controllers or setting arbitrary paths for them (especially paths that are different for the various controllers). This also introduces a new -.slice root slice, that is the parent of system.slice and friends. This enables easy admin configuration of root-level cgrouo properties. This replaces DeviceDeny= by DevicePolicy=, and implicitly adds in /dev/null, /dev/zero and friends if DeviceAllow= is used (unless this is turned off by DevicePolicy=).
2013-06-17core: add new .slice unit type for partitioning systemsLennart Poettering
In order to prepare for the kernel cgroup rework, let's introduce a new unit type to systemd, the "slice". Slices can be arranged in a tree and are useful to partition resources freely and hierarchally by the user. Each service unit can now be assigned to one of these slices, and later on login users and machines may too. Slices translate pretty directly to the cgroup hierarchy, and the various objects can be assigned to any of the slices in the tree.
2013-06-17mount: when learning about the root mount from mountinfo, don't add ↵Lennart Poettering
conflicting dep for umount.target That way systemd won't try to umount it at shutdown.
2013-05-02Add __attribute__((const, pure, format)) in various placesZbigniew Jędrzejewski-Szmek
I'm assuming that it's fine if a _const_ or _pure_ function calls assert. It is assumed that the assert won't trigger, and even if it does, it can only trigger on the first call with a given set of parameters, and we don't care if the compiler moves the order of calls.
2013-04-05Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek
Before, we would initialize many fields twice: first by filling the structure with zeros, and then a second time with the real values. We can let the compiler do the job for us, avoiding one copy. A downside of this patch is that text gets slightly bigger. This is because all zero() calls are effectively inlined: $ size build/.libs/systemd text data bss dec hex filename before 897737 107300 2560 1007597 f5fed build/.libs/systemd after 897873 107300 2560 1007733 f6075 build/.libs/systemd … actually less than 1‰. A few asserts that the parameter is not null had to be removed. I don't think this changes much, because first, it is quite unlikely for the assert to fail, and second, an immediate SEGV is almost as good as an assert.
2013-04-03util: rename parse_usec() to parse_sec() sinds the default unit is secondsLennart Poettering
Internally we store all time values in usec_t, however parse_usec() actually was used mostly to parse values in seconds (unless explicit units were specified to define a different unit). Hence, be clear about this and name the function about what we pass into it, not what we get out of it.
2013-03-31ModernizationZbigniew Jędrzejewski-Szmek
Use _cleanup_ and wrap lines to ~80 chars and such.
2013-03-29unit: replace remote-fs-setup.target by network-online.targetLennart Poettering
https://bugzilla.redhat.com/show_bug.cgi?id=787314
2013-03-27units: automatically order all mount units after network.targetLennart Poettering
Previously it was necessary to pull in remote-fs-pre.target to order the mount units against network.target since the ordering was done transitively via remote-fs-pre.target. As network implementations shouldn't need to know about the specific use-case of network mounts we instead now simply order network.target against all mounts too. This should make it unnecessary for network managing services to import remote-fs-pre.target explicitly, as network.target will now suffice.
2013-03-25units: introduce remote-fs-setup.target to pull in dependencies from remote ↵Lennart Poettering
mounts This introduces remote-fs-setup.target independently of remote-fs-pre.target. The former is only for pulling things in, the latter only for ordering. The new semantics: remote-fs-setup.target: is pulled in automatically by all remote mounts. Shall be used to pull in other units that want to run when at least one remote mount is set up. Is not ordered against the actual mount units, in order to allow activation of its dependencies even 'a posteriori', i.e. when a mount is established outside of systemd and is only picked up by it. remote-fs-pre.target: needs to be pulled in automatically by the implementing service, is otherwise not part of the initial transaction. This is ordered before all remote mount units. A service that wants to be pulled in and run before all remote mounts should hence have: a) WantedBy=remote-fs-setup.target -- so that it is pulled in b) Wants=remote-fs-pre.target + Before=remote-fs-pre.target -- so that it is ordered before the mount point, normally.
2013-03-15core: reuse the same /tmp, /var/tmp and inaccessible dirMichal Sekletar
All Execs within the service, will get mounted the same /tmp and /var/tmp directories, if service is configured with PrivateTmp=yes. Temporary directories are cleaned up by service itself in addition to systemd-tmpfiles. Directory which is mounted as inaccessible is created at runtime in /run/systemd.
2013-03-15core: keep mountinfo .mounts until late shutdownUmut Tezduyar
.mount units coming from /proc/self/mountinfo file are unmounted after local-fs.target is reached during shutdown. Problem: .mount units popping up in mountinfo file are added to systemd without any dependency. For that reason, they are the first one to be unmounted during shutdown. Whichever program mounted the file system deserves a chance to also unmount it. This patch ensures that /proc/self/mountinfo units will be unmounted after local-fs.target during shutdown (if they haven't been unmounted already)
2013-03-13core: single unit_kill implementation for all unit typesMichal Schmidt
There are very few differences in the implementations of the kill method in the unit types that have one. Let's unify them. This does not yet unify unit_kill() with unit_kill_context().
2013-03-12core: fix getting information about mount unitMichal Sekletar
We should not try to get information about mount unit from fragment if the unit was created because of /proc/self/mountinfo event.
2013-03-01fstab,mount: detect rbind as bind mountFrederic Crozat
Correctly detect rbind mount option as bind mount. Fixes https://bugzilla.novell.com/show_bug.cgi?id=804575.
2013-02-14core: do not overwrite existing units sourceUmut Tezduyar
Only set source for freshly created .mounts coming from mountinfo file.
2013-01-26core: unify kill code of mount, service, socket, swap unitsLennart Poettering