Skip to content

Commit

Permalink
udev: remove seqnum API and all assumptions about seqnums
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kaysievers committed Apr 14, 2014
1 parent a163b64 commit 9ea28c5
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 897 deletions.
6 changes: 4 additions & 2 deletions Makefile.am
Expand Up @@ -2587,8 +2587,7 @@ noinst_LTLIBRARIES += \

libudev_internal_la_SOURCES =\
$(libudev_la_SOURCES) \
src/libudev/libudev-device-private.c \
src/libudev/libudev-queue-private.c
src/libudev/libudev-device-private.c

libudev_internal_la_CFLAGS = \
$(AM_CFLAGS) \
Expand Down Expand Up @@ -5169,6 +5168,9 @@ test_libsystemd_sym_LDADD = \

test_libudev_sym_SOURCES = \
test-libudev-sym.c
test_libudev_sym_CFLAGS = \
$(AM_CFLAGS) \
-Wno-deprecated-declarations
test_libudev_sym_LDADD = \
libudev.la

Expand Down
22 changes: 0 additions & 22 deletions man/udevadm.xml
Expand Up @@ -338,35 +338,13 @@
return immediately.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-s</option></term>
<term><option>--seq-start=<replaceable>SEQNUM</replaceable></option></term>
<listitem>
<para>Wait only for events after the given sequence
number.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-e</option></term>
<term><option>--seq-end=<replaceable>SEQNUM</replaceable></option></term>
<listitem>
<para>Wait only for events before the given sequence number.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-E</option></term>
<term><option>--exit-if-exists=<replaceable>FILE</replaceable></option></term>
<listitem>
<para>Stop waiting if file exists.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-q</option></term>
<term><option>--quiet</option></term>
<listitem>
<para>Do not print any output, like the remaining queue entries when reaching the timeout.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<term><option>--help</option></term>
Expand Down
17 changes: 1 addition & 16 deletions src/libudev/libudev-monitor.c
Expand Up @@ -146,21 +146,6 @@ static bool udev_has_devtmpfs(struct udev *udev) {
return false;
}

/* we consider udev running when we have running udev service */
static bool udev_has_service(struct udev *udev) {
struct udev_queue *queue;
bool active;

queue = udev_queue_new(udev);
if (!queue)
return false;

active = udev_queue_get_udev_is_active(queue);
udev_queue_unref(queue);

return active;
}

struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd)
{
struct udev_monitor *udev_monitor;
Expand All @@ -184,7 +169,7 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c
* We do not set a netlink multicast group here, so the socket
* will not receive any messages.
*/
if (!udev_has_service(udev) && !udev_has_devtmpfs(udev)) {
if (access("/run/udev/control", F_OK) < 0 && !udev_has_devtmpfs(udev)) {
udev_dbg(udev, "the udev service seems not to be active, disable the monitor\n");
group = UDEV_MONITOR_NONE;
} else
Expand Down

0 comments on commit 9ea28c5

Please sign in to comment.