From 2b069d2ca55d6e24a6666ddab77e7a0c9cb7cd56 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Fri, 8 Jul 2011 16:49:04 +0000 Subject: [PATCH] Ignore activation/verify_udev_operations if dm kernel driver vsn < 4.18. --- WHATS_NEW | 1 + lib/commands/toolcontext.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 18ed33ed1..ad6413fe6 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -15,6 +15,7 @@ Version 2.02.86 - Fix to preserve exclusive activation of mirror while up-converting. Reject allocation if number of extents is not divisible by area count. Fix issue preventing cluster mirror creation. + Ignore activation/verify_udev_operations if dm kernel driver vsn < 4.18. Add activation/verify_udev_operations to lvm.conf, disabled by default. Call vg_mark_partial_lvs() before VG structure is returned from the cache. Remove unused internal flag ACTIVATE_EXCL from the code. diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c index e50fe3d38..b2b38dd59 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; -- 2.43.5