From: Colin Guthrie Date: Thu, 16 Feb 2012 00:00:03 +0000 (+0000) Subject: lvm: Only activate a given vg+lv once. X-Git-Tag: 017~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0330b919872073402c9e62bdad7b0f8916e0f5bf;p=thirdparty%2Fdracut.git 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. --- diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh index a4721911e..fd488350c 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 ]] && {