1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

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 <roland.kammerer@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
This commit is contained in:
Roland Kammerer 2018-06-21 11:32:32 +02:00 committed by Lennart Poettering
parent bc3c5e1619
commit fee854ee8c

View File

@ -311,6 +311,18 @@ static int worker_send_message(int fd) {
return loop_write(fd, &message, sizeof(message), false); 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) { static void worker_spawn(Manager *manager, struct event *event) {
struct udev *udev = event->udev; struct udev *udev = event->udev;
_cleanup_(udev_monitor_unrefp) struct udev_monitor *worker_monitor = NULL; _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. * udev has finished its event handling.
*/ */
if (!streq_ptr(udev_device_get_action(dev), "remove") && if (!streq_ptr(udev_device_get_action(dev), "remove") &&
streq_ptr("block", udev_device_get_subsystem(dev)) && shall_lock_device(dev)) {
!startswith(udev_device_get_sysname(dev), "dm-") &&
!startswith(udev_device_get_sysname(dev), "md")) {
struct udev_device *d = dev; struct udev_device *d = dev;
if (streq_ptr("partition", udev_device_get_devtype(d))) if (streq_ptr("partition", udev_device_get_devtype(d)))