From fee854ee8ccde0cd28e0f925dea18cce35f3993d Mon Sep 17 00:00:00 2001 From: Roland Kammerer Date: Thu, 21 Jun 2018 11:32:32 +0200 Subject: [PATCH] udev: exclude DRBD from block device ownership event locking It does not make sense for udev to even open DRBD block devices (/dev/drbdX). It is on one hand not necessary as DRBD is controlled by something else in the stack (e.g., pacemaker), and it even can get cumbersome in various scenarios (e.g., DRBD9 auto-promote). Closes: #9371 Signed-off-by: Roland Kammerer Signed-off-by: Lars Ellenberg --- src/udev/udevd.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/udev/udevd.c b/src/udev/udevd.c index da266bf035..34f6a95503 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -311,6 +311,18 @@ static int worker_send_message(int fd) { return loop_write(fd, &message, sizeof(message), false); } +static bool shall_lock_device(struct udev_device *dev) { + const char *sysname; + + if (!streq_ptr("block", udev_device_get_subsystem(dev))) + return false; + + sysname = udev_device_get_sysname(dev); + return !startswith(sysname, "dm-") && + !startswith(sysname, "md") && + !startswith(sysname, "drbd"); +} + static void worker_spawn(Manager *manager, struct event *event) { struct udev *udev = event->udev; _cleanup_(udev_monitor_unrefp) struct udev_monitor *worker_monitor = NULL; @@ -412,9 +424,7 @@ static void worker_spawn(Manager *manager, struct event *event) { * udev has finished its event handling. */ if (!streq_ptr(udev_device_get_action(dev), "remove") && - streq_ptr("block", udev_device_get_subsystem(dev)) && - !startswith(udev_device_get_sysname(dev), "dm-") && - !startswith(udev_device_get_sysname(dev), "md")) { + shall_lock_device(dev)) { struct udev_device *d = dev; if (streq_ptr("partition", udev_device_get_devtype(d)))