Commit graph

67 commits

Author SHA1 Message Date
Kay Sievers e918a1b5a9 udev: exclude device-mapper from block device ownership event locking 2014-06-03 16:49:38 +02:00
Kay Sievers 3d06f41834 udev: always close lock file descriptor
https://bugs.freedesktop.org/show_bug.cgi?id=79576
2014-06-03 11:06:43 +02:00
Thomas Hindoe Paaboel Andersen bf9bead187 udev: avoid use of uninitialized err
After 1ea972174b err is no longer
set unless we hit a special case. Initialize it to 0 and remove
a check that will never fail.
2014-05-17 08:41:48 +02:00
Kay Sievers 1ea972174b udev: do not skip the execution of RUN when renaming a network device fails 2014-05-15 10:32:26 +02:00
Kay Sievers 3ebdb81ef0 udev: serialize/synchronize block device event handling with file locks 2014-04-13 19:54:27 -07:00
Kay Sievers 9ea28c55a2 udev: remove seqnum API and all assumptions about seqnums
The way the kernel namespaces have been implemented breaks assumptions
udev made regarding uevent sequence numbers. Creating devices in a
namespace "steals" uevents and its sequence numbers from the host. It
confuses the "udevadmin settle" logic, which might block until util a
timeout is reached, even when no uevent is pending.

Remove any assumptions about sequence numbers and deprecate libudev's
API exposing these numbers; none of that can reliably be used anymore
when namespaces are involved.
2014-04-13 17:12:14 -07:00
Lennart Poettering c8a202b7d4 everywhere: always use O_CLOEXEC where it makes sense 2014-02-13 14:59:56 +01:00
Lennart Poettering 955d98c9c1 everywhere: make use of new0() and macro() macros, and stop using perror() 2014-02-13 14:45:51 +01:00
Greg KH 29804cc1e0 use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of
memset() calls that should be using memzero() to make it more "obvious"
that the options are correct (i.e. 0 is not the length, but the data to
set).  So fix up all current calls to memset(foo, 0, length) to
memzero(foo, length).
2014-01-31 11:55:01 +01:00
Kay Sievers ed14edc04f udev: LOG_PRIORITY -> LOG_LEVEL 2013-12-29 18:05:25 +01:00
Lennart Poettering 9f6445e34a log: log_error() and friends add a newline after each line anyway, so avoid including it in the log strings 2013-12-24 16:39:37 +01:00
Kay Sievers e3dc56a219 udev: declare some symbols static 2013-11-12 18:09:08 +01:00
Lennart Poettering 74df0fca09 util: unify reading of /proc/cmdline
Instead of individually checking for containers in each user do this
once in a new call proc_cmdline() that read the file only if we are not
in a container.
2013-11-06 03:15:16 +01:00
Zbigniew Jędrzejewski-Szmek 97fec53e5e udev: use initialization instead of zeroing in one place 2013-10-13 17:56:55 -04:00
Colin Walters 73814ca287 Revert "udevd: simplify sigterm check"
This reverts commit 47e737dc13 - it
introduced a use-after-free.  The only way the code would get simpler
is with a cleanup function, but eh, not worth it for just this one
bit.

Reviewed by kay on IRC.
2013-08-22 17:07:02 -04:00
Kay Sievers 47e737dc13 udevd: simplify sigterm check 2013-08-15 19:55:32 +02:00
Tom Gundersen 689a97f523 udevd: respect the log-level set in /etc/udev/udev.conf
A regression introduced when we moved to systemd's logging is that the only
way to adjust the log-level of the udev daemon is via the env var, kernel
commandline or the commandline.

This reintroduces support for specifying this in the configuration file.
2013-08-09 01:38:17 +02:00
Tom Gundersen 84b6ad702e udev: export tags of "dead" device nodes to /run/udev/static_node-tags/
Based on a patch by Kay Sievers.

A tag is exported at boot as a symlinks to the device node in the folder
/run/udev/static_node-tags/<tagname>/, if the device node exists.

These tags are cleaned up by udevadm info --cleanup-db, but are otherwise
never removed.
2013-07-16 20:07:57 +02:00
Tom Gundersen edeb68c53f static-nodes: move creation of static nodes from udevd to tmpfiles
As of kmod v14, it is possible to export the static node information from
/lib/modules/`uname -r`/modules.devname in tmpfiles.d(5) format.

Use this functionality to let systemd-tmpfilesd create the static device nodes
at boot, and drop the functionality from systemd-udevd.

As an effect of this we can move from systemd-udevd to systemd-tmpfiles-setup-dev:

 * the conditional CAP_MKNOD (replaced by checking if /sys is mounted rw)
 * ordering before local-fs-pre.target (see 89d09e1b5c)
2013-07-08 21:26:24 +02:00
Lennart Poettering 7027ff61a3 nspawn: introduce the new /machine/ tree in the cgroup tree and move containers there
Containers will now carry a label (normally derived from the root
directory name, but configurable by the user), and the container's root
cgroup is /machine/<label>. This label is called "machine name", and can
cover both containers and VMs (as soon as libvirt also makes use of
/machine/).

libsystemd-login can be used to query the machine name from a process.

This patch also includes numerous clean-ups for the cgroup code.
2013-04-16 04:41:21 +02:00
Lennart Poettering 574d5f2dfc util: rename write_one_line_file() to write_string_file()
You can write much more than just one line with this call (and we
frequently do), so let's correct the naming.
2013-04-03 20:12:56 +02:00
Václav Pavlín f459285212 udev: check return value of uname. 2013-03-28 23:45:58 -04:00
Kay Sievers d8d4bee76c build-sys: fix HAVE/ENABLE_FIRMWARE
https://bugs.freedesktop.org/show_bug.cgi?id=62864
2013-03-28 15:28:10 +01:00
Harald Hoyer 8cc3f8c0bc udevd.c: set udev children_max according to CPU count
Setting children_max according to RAM leads to too much concurrent I/O.
2013-03-25 13:11:18 +01:00
Kay Sievers 61e536e1b7 udev: ifdef all firmware special handling 2013-03-18 15:22:32 +01:00
Kay Sievers 1d600df55b udev: remove database conversion code 2013-03-03 18:35:22 +01:00
Harald Hoyer a5c32cff1f honor SELinux labels, when creating and writing config files
Also split out some fileio functions to fileio.c and provide a SELinux
aware pendant in fileio-label.c

see https://bugzilla.redhat.com/show_bug.cgi?id=881577
2013-02-14 16:19:38 +01:00
Thomas Hindoe Paaboel Andersen 090be86534 use streq instead of strcmp 2013-02-13 18:14:20 +01:00
Kay Sievers d5a89d7dc1 udev: move string copy functions to shared/ 2013-01-09 19:06:46 +01:00
Lukas Nykryn 5bbbe461fd udevd: add missing ':' to getopt_long 'e'
Parameter -e is set without additional argument in getopt
and this leads to segfault when calling 'systemd-udevd -e'.
2012-12-22 15:19:15 +01:00
Kay Sievers 1298001ec5 use the same email address everywhere 2012-11-12 19:47:43 +01:00
Kay Sievers 40fe8b11be udev: use usec_t and now() 2012-11-12 01:03:14 +01:00
Kay Sievers ea6039a309 udev: allow firmware requests to bypass the dependency tracking
The removal of the TIMEOUT= handling in udevd put firmware requests into the
devpath parent/child dependency tracking. Drivers which block in module_init()
asking userspace for firmware ran into a 30 sec device timeout.

The whole firmware loading willl hopefully move into the kernel and
the fragile-since-day-one fake async driver-core device dance involving
udev can be retired:
  http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=abb139e75c2cdbb955e840d6331cb5863e409d0e
2012-10-07 18:22:14 +02:00
Thomas Hindoe Paaboel Andersen c53158818d man: fix a bunch of typos in docs
https://bugs.freedesktop.org/show_bug.cgi?id=54501
2012-09-13 19:34:24 +02:00
Lennart Poettering 01ed0e2307 dev-setup: make NULL as parameter for dev_setup() equivalent to "" 2012-08-21 17:23:03 +02:00
Dave Reisner 8f0e73f250 dev-setup: allow a path prefix for use in chroots
With this adjustment, we can reuse this code elsewhere, such as in
nspawn.
2012-08-21 17:19:35 +02:00
Kay Sievers 7781e063e8 udev: re-initialize builtins in the daemon process, not in the worker 2012-08-08 16:27:11 +02:00
Kay Sievers 023b9d33e9 udev: set log.c's log level from udev's kernel command line option 2012-07-30 22:34:07 +02:00
Kay Sievers c6eefe3664 udev: avoid creating /dev/kmsg with fopen() to support CONFIG_PRINTK=n 2012-07-14 00:33:59 +02:00
Lennart Poettering 4b2615684b log: correct usage of logging API at a few places 2012-07-13 15:45:45 +02:00
Kay Sievers 47ef94ac5f udev: add some O_CLOEXEC 2012-07-05 17:33:24 +02:00
Kay Sievers ef8a2bf648 udev: static nodes - fix default permissions if no rules is given
<falconindy> kay: just curious -- it looks like nodes created by udev from
  modules.devname all have 000 perms, and there's nothing in udev that attempts
  to change this. is it intended?
<falconindy> c---------   1 root root     10, 223 Jul  1 23:10 uinput
<kay> falconindy: we might miss the default of 0600
<falconindy> seems like it
<kay> falconindy: stuff that has a rule works i guess
<kay> falconindy: i'll add the 0600 now
2012-07-02 20:45:59 +02:00
Dave Reisner ddbe6850b2 udevd: fix bogus mkdir invocation
The filename parameter passed to mkdir can't contain anything but a
garbage value at this point. This was meant to be the full pathname to
the new udev DB, as the mkdir_parents() call before it won't create the
trailing child directory.

[replace mkdir_parents() + mkdir() with mkdir_p() -- kay]
2012-07-02 03:09:18 +02:00
Dave Reisner b80680eda9 udevd: use ROOTPREFIX to create path to modules.devname 2012-07-02 03:04:24 +02:00
Kay Sievers 72a2af7aa9 udev: use the matching binary name "systemd-udevd" in log messages 2012-06-27 15:29:55 +02:00
Kay Sievers e6f86cac16 udev: kernel cmdline - accept rd.* parameters 2012-06-04 22:46:32 +02:00
Kay Sievers 145dae7eb3 udev: reset /proc/self/oom_score_adj in worker processes
Only the main daemon process should be excluded from OOM handling,
not the worker processes or their child processes.
2012-06-04 18:10:50 +02:00
Kay Sievers d315bba6f6 udev: limit minimum worker count to 16 2012-06-04 16:40:31 +02:00
Lauri Kasanen a52289f7f5 udev: lower the starting children_max -> drop the minimum required RAM from 23mb to 5mb
Udev was the limiting factor for us on low-RAM systems.
Given an average RSS of 180kb, 128 workers would require ~23mb of RAM.

Now, please consider what happens when there is only, say, 15mb free.
Udev protects itself from OOM, and the kernel can do nothing but panic.

28 workers * 0.18mb = ~5mb. This change should not affect more powerful
systems much, given that they still get the addition from the amount of RAM.
2012-06-04 16:02:33 +02:00
Kay Sievers 0f9963a8b8 Revert "label: fix systemd-udev labeling of /run directory."
This reverts commit 9b5af248f0.

Udev now explicitely labels only files/directories in /dev. The selinux
array API is not released and will not work on other distros at this moment.
2012-05-31 13:34:41 +02:00