summaryrefslogtreecommitdiffstats
path: root/lib/commands
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2011-07-08 16:49:04 +0000
committerAlasdair Kergon <agk@redhat.com>2011-07-08 16:49:04 +0000
commit1485b6fc93994200d8e187f8bf4e86749fe627cb (patch)
treee02e22e671a14a3e0b13a726d41d7801c189cb79 /lib/commands
parentd8ff1b1efb0eaeaa384bde8296ab4c3b37d5a718 (diff)
downloadlvm2-1485b6fc93994200d8e187f8bf4e86749fe627cb.tar.gz
lvm2-1485b6fc93994200d8e187f8bf4e86749fe627cb.tar.xz
lvm2-1485b6fc93994200d8e187f8bf4e86749fe627cb.zip
Ignore activation/verify_udev_operations if dm kernel driver vsn < 4.18.
Diffstat (limited to 'lib/commands')
-rw-r--r--lib/commands/toolcontext.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index e50fe3d3..b2b38dd5 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -200,6 +200,21 @@ static void _init_logging(struct cmd_context *cmd)
reset_lvm_errno(1);
}
+/*
+ * Until the DM_UEVENT_GENERATED_FLAG was introduced in kernel patch
+ * 856a6f1dbd8940e72755af145ebcd806408ecedd
+ * some operations could not be performed by udev, requiring our fallback code.
+ */
+static int _dm_driver_has_stable_udev_support()
+{
+ char vsn[80];
+ unsigned maj, min, patchlevel;
+
+ return driver_version(vsn, sizeof(vsn)) &&
+ (sscanf(vsn, "%u.%u.%u", &maj, &min, &patchlevel) == 3) &&
+ (maj == 4 ? min >= 18 : maj > 4);
+}
+
static int _process_config(struct cmd_context *cmd)
{
mode_t old_umask;
@@ -299,6 +314,13 @@ static int _process_config(struct cmd_context *cmd)
find_config_tree_int(cmd, "activation/verify_udev_operations",
DEFAULT_VERIFY_UDEV_OPERATIONS) : 1;
+ /* Do not rely fully on udev if the udev support is known to be incomplete. */
+ if (!cmd->default_settings.udev_fallback && !_dm_driver_has_stable_udev_support()) {
+ log_very_verbose("Kernel driver has incomplete udev support so "
+ "LVM will check and perform some operations itself.");
+ cmd->default_settings.udev_fallback = 1;
+ }
+
#else
/* We must use old node/symlink creation code if not compiled with udev support at all! */
cmd->default_settings.udev_fallback = 1;