]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
lvm: Only activate a given vg+lv once.
authorColin Guthrie <colin@mageia.org>
Thu, 16 Feb 2012 00:00:03 +0000 (00:00 +0000)
committerHarald Hoyer <harald@redhat.com>
Wed, 22 Feb 2012 17:30:58 +0000 (18:30 +0100)
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

index a4721911e4ae9d7caa991d94e77dd438a0aee0e8..fd488350c2a8bf388a0be14de8df423767d91ad4 100755 (executable)
@@ -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 ]] && {