summaryrefslogtreecommitdiff
path: root/src/core/mount.c
Commit message (Collapse)AuthorAge
* mount: fix up wording in the commentMichal Sekletar2015-04-01
|
* mount: don't run quotaon only for network filesystemsLukas Nykryn2015-04-01
| | | | | | If you have for example ext4 on iscsi devices it is possible to setup qoutas there. Unfortunately, because such fstab entry contains _netdev, systemd will not add dependency to quotaon.service.
* core: do not spawn jobs or touch other units during coldpluggingIvan Shapovalov2015-03-07
| | | | | | | | | | | | | Because the order of coldplugging is not defined, we can reference a not-yet-coldplugged unit and read its state while it has not yet been set to a meaningful value. This way, already active units may get started again. We fix this by deferring such actions until all units have been at least somehow coldplugged. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=88401
* core: expose consumed CPU time per unitLennart Poettering2015-03-02
| | | | | | This adds support for showing the accumulated consumed CPU time per-unit in the "systemctl status" output. The property is also readable via the bus.
* core: rework device state logicLennart Poettering2015-02-28
| | | | | | | | | | | | | This change introduces a new state "tentative" for device units. Device units are considered "plugged" when udev announced them, "dead" when they are not available in the kernel, and "tentative" when they are referenced in /proc/self/mountinfo or /proc/swaps but not (yet) announced via udev. This should fix a race when device nodes (like loop devices) are created and immediately mounted. Previously, systemd might end up seeing the mount unit before the device, and would thus pull down the mount because its BindTo dependency on the device would not be fulfilled.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* util: rework strappenda(), and rename it strjoina()Lennart Poettering2015-02-03
| | | | | | After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
* core/mount: add dependencies to dynamically mounted mounts tooMartin Pitt2015-01-28
| | | | | | | | | | Add unit dependencies for dynamic (i. e. not from fstab) mounts. With that, mount units properly bind to their underlying device, and thus get automatically stopped/unmounted when the underlying device goes away. This cleans up stale mounts from unplugged devices. Thanks to Lennart Poettering for pointing out the fix!
* core: output unit status output strings to console, only if we actually are ↵Lennart Poettering2015-01-28
| | | | | | | | | changing unit state Unit _start() and _stop() implementations can fail with -EAGAIN to delay execution temporarily. Thus, we should not output status messages before invoking these calls, but after, and only when we know that the invocation actually made a change.
* core,shutdown: don't bother with unmounting any mounts below /sys, /proc, ↵Lennart Poettering2015-01-23
| | | | | | | | | | | /dev when shutting down After all, mounts below these directories are pretty much guaranteed to be virtual, and it's hence unnecessary to unmount them during shutdown. Moreover, in less-priviliged containers we might lack the rights to unmount them, hence don't even try. http://lists.freedesktop.org/archives/systemd-devel/2015-January/027113.html
* core/mount: remove "fail" againZbigniew Jędrzejewski-Szmek2015-01-12
| | | | | | | deb6120920 'man: there's actually no "fail" fstab option, but only "nofail" removed it from our documentation, which I missed. fstab(5) only mentions "auto", "noauto", and "nofail". Stick to those three.
* core/mount: use isempty() to check for empty stringsDaniel Mack2015-01-12
| | | | | | | | | strempty() will return an empty string in case the input parameter is a NULL pointer. The correct test to check for an empty string is isempty(), so use that instead. This fixes a regression from commit 17a1c59 ("core/mount: filter out noauto,auto,nofail,fail options").
* core/mount: filter out noauto,auto,nofail,fail optionsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | | | | | | | | We passed the full option string from fstab to /bin/mount. It would in turn pass the full option string to its helper, if it needed to invoke one. Some helpers would ignore things like "nofail", but others would be confused. We could try to get all helpers to ignore those "meta-options", but it seems better to simply filter them out. In our model, /bin/mount simply has no business in knowing whether the mount was configured as fail or nofail, auto or noauto, in the fstab. If systemd tells invokes a command to mount something, and it fails, it should always return an error. It seems cleaner to filter out the option, since then there's no doubt how the command should behave. https://bugzilla.redhat.com/show_bug.cgi?id=1177823
* Add new function to filter fstab optionsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | | | | | | | | | | | This fixes parsing of options in shared/generator.c. Existing code had some issues: - it would treate whitespace and semicolons as seperators. fstab(5) is pretty clear that only commas matter. And the syntax does not allow for spaces to be inserted in the field in fstab. Whitespace might be escaped, but then it should not seperate options. Treat whitespace and semicolons as any other character. - it assumed that x-systemd.device-timeout would always be followed by "=". But this is not guaranteed, hasmntopt will return this option even if there's no value. Uninitialized memory could be read. - some error paths would log, and inconsistently, some would just return an error code. Filtering is split out to a separate function and tests are added. Similar code paths in other places are adjusted to use the new function.
* mount: do not use -n when running in --user modeZbigniew Jędrzejewski-Szmek2015-01-01
| | | | | | | | -n is only allowed for root. /etc/mtab is nowadays almost always a link to /proc/, so in practice this does not really matter too much, but should allow .mount units to work in --user mode. https://bugs.freedesktop.org/show_bug.cgi?id=87602
* util: fix strict aliasing violations in use of struct inotify_event v5Shawn Paul Landden2014-12-24
| | | | | There is alot of cleanup that will have to happen to turn on -fstrict-aliasing, but I think our code should be "correct" to the rule.
* unit: handle nicely of certain unit types are not supported on specific systemsLennart Poettering2014-12-15
| | | | | | | | | | | | Containers do not really support .device, .automount or .swap units; Systems compiled without support for swap do not support .swap units; Systems without kdbus do not support .busname units. With this change attempts to start a unsupported unit types will result in an immediate "unsupported" job result, which is a lot more descriptive then before. Also, attempts to start device units in containers will now immediately fail instead of causing jobs to be enqueued that never go away.
* core: retry unmounting until we are done, in case of stacked mountsLennart Poettering2014-12-12
|
* sd-bus: move common errors src/shared/bus-errors.h → ↵Lennart Poettering2014-12-10
| | | | | | src/libsystemd/sd-bus/bus-common-errors.h Stuff in src/shared/ should not use stuff from src/libsystemd/ really.
* mount: clarify that we really need to replace the utab inotify code with the ↵Lennart Poettering2014-12-10
| | | | native API for this in libmount, as soon as that's stable
* core: unify how we iterate over inotify eventsLennart Poettering2014-12-10
| | | | | Let's add some syntactic sugar for iterating through inotify events, and use it everywhere.
* mount: use bools where appropriateLennart Poettering2014-12-10
|
* mount: use DEFINE_TRIVIAL_CLEANUP_FUNCZbigniew Jędrzejewski-Szmek2014-11-28
|
* mount: constify MountParametersZbigniew Jędrzejewski-Szmek2014-11-28
|
* mount: deal with inotify queue overflowZbigniew Jędrzejewski-Szmek2014-11-28
| | | | | Overflow is very unlikely, since we are watching a privileged directory, but could be triggered if thousands of mounts are suddently executed.
* mount: create directory before adding watches on itZbigniew Jędrzejewski-Szmek2014-11-28
|
* mount: be more careful about errors when parsing mtabZbigniew Jędrzejewski-Szmek2014-11-28
| | | | Fixup for 4a3a9ef610.
* mount: simplify mount_needs_network checkZbigniew Jędrzejewski-Szmek2014-11-28
|
* mount: check options as well as fstype for network mountsChris Leech2014-11-28
| | | | | | When creating a new mount unit after an event on /proc/self/mountinfo, check the mount options as well as the fstype to determine if this is a remote mount that requires network access.
* mount: add remote-fs dependencies if needed after changeChris Leech2014-11-28
| | | | | | | | | | This is an attempt to add it the remote-fs dependencies to a mount unit if the options change, like when the utab options are picked up after mountinfo has already been processed. It just adds the remote-fs dependencies, leaving the local-fs ones in place. With this change I always get mount units with proper remote-fs dependencies when mounted with the _netdev option.
* mount: monitor for utab changes with inotifyChris Leech2014-11-28
| | | | | | | | | | | | | | Parsing the mount table with libmount races against the mount command, which will handle the actual mounting before updating utab. This means the poll event on /proc/self/mountinfo can kick of a reparse in systemd before the utab information is available. This change adds in an additional event source using inotify to watch for changes to utab. It only watches for IN_MOVED_TO events, matching libmount behavior of always overwriting this file using rename(2). This does add a second pass through the mount table parsing when utab is updated.
* mount: use libmount to enumerate /proc/self/mountinfoChris Leech2014-11-28
| | | | | This lets libmount add in user options from /run/mount/utab, like _netdev which is needed to get proper ordering against remote-fs.target
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-28
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-28
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* log: fix order of log_unit_struct() to match other logging callsLennart Poettering2014-11-28
| | | | | Also, while we are at it, introduce some syntactic sugar for creating ERRNO= and MESSAGE= structured logging fields.
* log: rearrange log function namingLennart Poettering2014-11-27
| | | | | | | | | | - Rename log_meta() → log_internal(), to follow naming scheme of most other log functions that are usually invoked through macros, but never directly. - Rename log_info_object() to log_object_info(), simply because the object should be before any other parameters, to follow OO-style programming style.
* manager: only issue overmount warning when the check succeededZbigniew Jędrzejewski-Szmek2014-11-23
| | | | | If for any reason the check failed (selinux?), we would still issue the warning. Check the return status.
* core: introduce new Delegate=yes/no property controlling creation of cgroup ↵Lennart Poettering2014-11-05
| | | | | | | | | | | | | | | | | | | | | | | | subhierarchies For priviliged units this resource control property ensures that the processes have all controllers systemd manages enabled. For unpriviliged services (those with User= set) this ensures that access rights to the service cgroup is granted to the user in question, to create further subgroups. Note that this only applies to the name=systemd hierarchy though, as access to other controllers is not safe for unpriviliged processes. Delegate=yes should be set for container scopes where a systemd instance inside the container shall manage the hierarchies below its own cgroup and have access to all controllers. Delegate=yes should also be set for user@.service, so that systemd --user can run, controlling its own cgroup tree. This commit changes machined, systemd-nspawn@.service and user@.service to set this boolean, in order to ensure that container management will just work, and the user systemd instance can run fine.
* core: send sigabrt on watchdog timeout to get the stacktraceUmut Tezduyar Lindskog2014-10-28
| | | | | if sigabrt doesn't do the job, follow regular shutdown routine, sigterm > sigkill.
* Revert "mount: order options before other arguments to mount"Lennart Poettering2014-10-02
| | | | | | | This reverts commit 141a1ceaa62578f1ed14f04cae2113dd0f49fd7f. People should fix their libc's getopt(), instead of us using a weird option ordering...
* mount: order options before other arguments to mountEmil Renner Berthing2014-09-18
|
* exec: factor out most function arguments of exec_spawn() to ExecParametersDaniel Mack2014-09-05
| | | | | | | | | | This way, the list of arguments to that function gets more comprehensive, and we can get around passing lots of NULL and 0 arguments from socket.c, swap.c and mount.c. It also allows for splitting up the code in exec_spawn(). While at it, make ExecContext const in execute.c.
* core: Refuse mount on symlinkTimofey Titovets2014-08-15
|
* core: do not add default dependencies to /usr mount unitJon Severinsson2014-08-14
| | | | | | This makes no difference if /usr was mounted in the initrd, and brings the behaviour of legacy systems closer to those with a propper initrd.
* Move x-systemd-device.timeout handling from core to fstab-generatorZbigniew Jędrzejewski-Szmek2014-06-30
| | | | | | | | | | | | | Instead of adjusting job timeouts in the core, let fstab-generator write out a dropin snippet with the appropriate JobTimeout. x-systemd-device.timeout option is removed from Options= line in the generated unit. The functions to write dropins are moved from core/unit.c to shared/dropin.c, to make them available outside of core. generator.c is moved to libsystemd-label, because it now uses functions defined in dropin.c, which are in libsystemd-label.
* mount: add new SloppyOptions= setting for mount units, mapping to mount(8)'s ↵Lennart Poettering2014-06-16
| | | | "-s" switch
* mount: tell /bin/mount to never touch /etc/mtabLennart Poettering2014-06-16
| | | | | | | | | | | | | | | | | /etc/mtab should die die die. It's sad enough util-linux still contains support for it, but we don't have to partake in that charade, so let's turn this off. This is in-line with the fact that since years we already have been "tainting" systemd if we detect /etc/mtab not being a symlink... Of course, util-linux is currently broken, and still touches /etc/mtab, weven if we pass "--no-mtab" to it: https://bugzilla.redhat.com/show_bug.cgi?id=1109367 But hey, let's hope that gets fixed quickly, even if total removal of /etc/mtab support from util-linux might not happen so quickly...
* core: allow transient mount unitsTom Gundersen2014-06-07
| | | | | For now only What=, Options=, Type= are supported, and Where= is deduced from the unit name.
* sd-event: rework API to support CLOCK_REALTIME_ALARM and ↵Lennart Poettering2014-03-24
| | | | CLOCK_BOOTTIME_ALARM, too
* core: rework context initialization/destruction logicLennart Poettering2014-03-19
| | | | | | | | 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.