From 0330b919872073402c9e62bdad7b0f8916e0f5bf Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Thu, 16 Feb 2012 00:00:03 +0000 Subject: [PATCH] lvm: Only activate a given vg+lv once. Due to the way the main loop runs to detect partions, the same one might be included twice (albeit via different symlinks. This code simply prevents the same combo being activated twice. A better fix might simply be to not include duplicate (after resolving symlinks) entries in the host_fs_types variable. --- modules.d/90lvm/module-setup.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh index a4721911..fd488350 100755 --- a/modules.d/90lvm/module-setup.sh +++ b/modules.d/90lvm/module-setup.sh @@ -3,7 +3,7 @@ # ex: ts=8 sw=4 sts=4 et filetype=sh check() { - local _rootdev + local _rootdev _activated # No point trying to support lvm if the binaries are missing type -P lvm >/dev/null || return 1 @@ -15,7 +15,10 @@ check() { unset DM_LV_NAME eval $(udevadm info --query=property --name=$1|egrep '(DM_VG_NAME|DM_LV_NAME)=') [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return - echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf" + if ! strstr " ${_activated[*]} " " ${DM_VG_NAME}/${DM_LV_NAME} "; then + echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf" + push _activated "${DM_VG_NAME}/${DM_LV_NAME}" + fi } [[ $hostonly ]] || [[ $mount_needs ]] && {