All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Enhancements and bug fixes for --mount
@ 2011-12-20  6:09 Cong Wang
       [not found] ` <1324361401-6908-1-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Cong Wang @ 2011-12-20  6:09 UTC (permalink / raw)
  To: harald-H+wXaHxf7aLQT0dZR+AlfA; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

This patchset is based on "usrmove" branch, contains several bug fixes
and some enhancements for the new option '--mount'.

With these patches applied, kdump works well with dracut (the lvm case).

All patches are available at:

	git://github.com/congwang/dracut.git #kdump

Cong Wang (6):
  Add mount points even not in hostonly mode
  Check module dependencies of mount points
  Fix get_maj_min() to follow symlink
  Pass device name instead of major:minor in for_each_host_dev_fs()
  nfs: fix regex patterns in check()
  lvm: pass the correct rd.lvm.lv parameter

 dracut                                  |   83 ++++++++++++++++---------------
 dracut-functions                        |   81 ++++++++++++++++++++++++++---
 modules.d/00bootchart/module-setup.sh   |    1 +
 modules.d/10i18n/module-setup.sh        |    1 +
 modules.d/10rpmversion/module-setup.sh  |    1 +
 modules.d/50plymouth/module-setup.sh    |    1 +
 modules.d/90btrfs/module-setup.sh       |    2 +-
 modules.d/90crypt/module-setup.sh       |    2 +-
 modules.d/90dmraid/module-setup.sh      |    2 +-
 modules.d/90lvm/module-setup.sh         |   17 ++----
 modules.d/90mdraid/module-setup.sh      |    2 +-
 modules.d/95fcoe/module-setup.sh        |    2 +-
 modules.d/95nfs/module-setup.sh         |    8 ++--
 modules.d/97biosdevname/module-setup.sh |    1 +
 modules.d/98usrmount/module-setup.sh    |    1 +
 15 files changed, 135 insertions(+), 70 deletions(-)

-- 
1.7.7.4

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/6] Allow to add mount points even not in hostonly mode
       [not found] ` <1324361401-6908-1-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2011-12-20  6:09   ` Cong Wang
       [not found]     ` <1324361401-6908-2-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2011-12-20  6:09   ` [PATCH 2/6] Check module dependencies of mount points Cong Wang
                     ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Cong Wang @ 2011-12-20  6:09 UTC (permalink / raw)
  To: harald-H+wXaHxf7aLQT0dZR+AlfA; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Don't force --mount only working in hostonly mode, let users decide.
With this patch, people can still combine -H --mount '...' if they
want to use it in hostonly mode.

Signed-off-by: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 dracut |   77 +++++++++++++++++++++++++++++++--------------------------------
 1 files changed, 38 insertions(+), 39 deletions(-)

diff --git a/dracut b/dracut
index 8449fc1..3a7c4fe 100755
--- a/dracut
+++ b/dracut
@@ -525,40 +525,25 @@ trap 'exit 1;' SIGINT
 # Need to be able to have non-root users read stuff (rpcbind etc)
 chmod 755 "$initdir"
 
+for line in "${fstab_lines[@]}"; do
+    set -- $line
+    #dev mp fs fsopts
+    dev="$(get_maj_min $1)"
+    push host_devs "${dev:-$1}"
+    push host_fs_types "$dev|$3"
+done
+
+for f in $add_fstab; do
+    [ -e $f ] || continue
+    while read dev rest; do
+        push host_devs $dev
+    done < $f
+done
+
 if [[ $hostonly ]]; then
     # in hostonly mode, determine all devices, which have to be accessed
     # and examine them for filesystem types
 
-    unset host_fs_types
-
-    _get_fs_type() (
-        [[ $1 ]] || return
-        if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then
-            echo "$1|$ID_FS_TYPE"
-            return 1
-        fi
-        if fstype=$(find_dev_fstype $1); then
-            echo "$1|$fstype"
-            return 1
-        fi
-        return 1
-    )
-
-    for line in "${fstab_lines[@]}"; do
-        set -- $line
-        #dev mp fs fsopts
-        dev="$(get_maj_min $1)"
-        push host_devs "${dev:-$1}"
-        push host_fs_types "$dev|$3"
-    done
-
-    for f in $add_fstab; do
-        [ -e $f ] || continue
-        while read dev rest; do
-            push host_devs $dev
-        done < $f
-    done
-
     push host_mp \
         "/" \
         "/etc" \
@@ -573,17 +558,31 @@ if [[ $hostonly ]]; then
         mountpoint "$mp" >/dev/null 2>&1 || continue
         push host_devs $(find_block_device "$mp")
     done
-    for dev in "${host_devs[@]}"; do
-        unset fs_type
-        for fstype in $(_get_fs_type $dev) \
-            $(check_block_and_slaves _get_fs_type $dev); do
-            if ! strstr " ${host_fs_types[*]} " " $fstype ";then
-                push host_fs_types "$fstype"
-            fi
-        done
-    done
 fi
 
+_get_fs_type() (
+    [[ $1 ]] || return
+    if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then
+        echo "$1|$ID_FS_TYPE"
+        return 1
+    fi
+    if fstype=$(find_dev_fstype $1); then
+        echo "$1|$fstype"
+        return 1
+    fi
+    return 1
+)
+
+for dev in "${host_devs[@]}"; do
+    unset fs_type
+    for fstype in $(_get_fs_type $dev) \
+        $(check_block_and_slaves _get_fs_type $dev); do
+        if ! strstr " ${host_fs_types[*]} " " $fstype ";then
+            push host_fs_types "$fstype"
+        fi
+    done
+done
+
 export initdir dracutbasedir dracutmodules drivers \
     fw_dir drivers_dir debug no_kernel kernel_only \
     add_drivers mdadmconf lvmconf filesystems \
-- 
1.7.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/6] Check module dependencies of mount points
       [not found] ` <1324361401-6908-1-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2011-12-20  6:09   ` [PATCH 1/6] Allow to add mount points even not in hostonly mode Cong Wang
@ 2011-12-20  6:09   ` Cong Wang
       [not found]     ` <1324361401-6908-3-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2011-12-20  6:09   ` [PATCH 3/6] Fix get_maj_min() to follow symlink Cong Wang
                     ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Cong Wang @ 2011-12-20  6:09 UTC (permalink / raw)
  To: harald-H+wXaHxf7aLQT0dZR+AlfA; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Like -H, we need to poll every module to check if it is needed
to mount a specific device in '--mount'.

Signed-off-by: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 dracut                                  |    5 ++-
 dracut-functions                        |   68 +++++++++++++++++++++++++++++-
 modules.d/00bootchart/module-setup.sh   |    1 +
 modules.d/10i18n/module-setup.sh        |    1 +
 modules.d/10rpmversion/module-setup.sh  |    1 +
 modules.d/50plymouth/module-setup.sh    |    1 +
 modules.d/90btrfs/module-setup.sh       |    2 +-
 modules.d/90crypt/module-setup.sh       |    2 +-
 modules.d/90dmraid/module-setup.sh      |    2 +-
 modules.d/90lvm/module-setup.sh         |    2 +-
 modules.d/90mdraid/module-setup.sh      |    2 +-
 modules.d/95fcoe/module-setup.sh        |    2 +-
 modules.d/95nfs/module-setup.sh         |    2 +-
 modules.d/97biosdevname/module-setup.sh |    1 +
 modules.d/98usrmount/module-setup.sh    |    1 +
 15 files changed, 82 insertions(+), 11 deletions(-)

diff --git a/dracut b/dracut
index 3a7c4fe..452067d 100755
--- a/dracut
+++ b/dracut
@@ -633,9 +633,12 @@ else
     done
 fi
 
+mods_to_load=""
 # check all our modules to see if they should be sourced.
 # This builds a list of modules that we will install next.
-check_module_dir
+for_each_module_dir check_module
+for_each_module_dir check_mount
+
 modules_loaded=" "
 # source our modules.
 for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
diff --git a/dracut-functions b/dracut-functions
index d95df14..54b1c30 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -760,6 +760,67 @@ module_installkernel() {
     fi
 }
 
+module_check_mount() {
+    local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
+    local _ret
+    mount_needs=1
+    [[ -d $_moddir ]] || return 1
+    if [[ ! -f $_moddir/module-setup.sh ]]; then
+        # if we do not have a check script, we are unconditionally included
+        [[ -x $_moddir/check ]] || return 0
+        mount_needs=1 $_moddir/check 0
+        _ret=$?
+    else
+        unset check depends install installkernel
+        . $_moddir/module-setup.sh
+        is_func check || return 1
+        check 0
+        _ret=$?
+        unset check depends install installkernel
+    fi
+    unset mount_needs
+    return $_ret
+}
+
+check_mount() {
+    local _mod=$1
+    local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
+    local _ret
+    local _moddep
+    # If we are already scheduled to be loaded, no need to check again.
+    strstr " $mods_to_load " " $_mod " && return 0
+    strstr " $mods_checked_as_dep " " $_mod " && return 1
+
+    # This should never happen, but...
+    [[ -d $_moddir ]] || return 1
+
+    [[ $2 ]] || mods_checked_as_dep+=" $_mod "
+
+    strstr " $omit_dracutmodules " " $_mod " && return 1
+
+    if [ "${#host_fs_types[*]}" -gt 0 ]; then
+        module_check_mount $_mod || return 1
+    else
+        # skip this module
+        return 1
+    fi
+
+    for _moddep in $(module_depends $_mod); do
+        # handle deps as if they were manually added
+        strstr " $add_dracutmodules " " $_moddep " || \
+            add_dracutmodules+=" $_moddep "
+        strstr " $force_add_dracutmodules " " $_moddep " || \
+            force_add_dracutmodules+=" $_moddep "
+        # if a module we depend on fail, fail also
+        check_module $_moddep || return 1
+    done
+
+    strstr " $mods_to_load " " $_mod " || \
+        mods_to_load+=" $_mod "
+
+    return 0
+}
+
 check_module() {
     local _mod=$1
     local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
@@ -811,14 +872,15 @@ check_module() {
     return 0
 }
 
-check_module_dir() {
+for_each_module_dir() {
     local _modcheck
     local _mod
     local _moddir
-    mods_to_load=""
+    local _func
+    _func=$1
     for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
         _mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
-        check_module $_mod 1
+        $_func $_mod 1
     done
 
     # Report any missing dracut modules, the user has specified
diff --git a/modules.d/00bootchart/module-setup.sh b/modules.d/00bootchart/module-setup.sh
index bf71b14..17dd137 100755
--- a/modules.d/00bootchart/module-setup.sh
+++ b/modules.d/00bootchart/module-setup.sh
@@ -3,6 +3,7 @@
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
 check() {
+    [[ "$mount_needs" ]] && return 1
     [ -x /sbin/bootchartd ] || return 1
     return 255
 }
diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh
index 6248607..f389d14 100755
--- a/modules.d/10i18n/module-setup.sh
+++ b/modules.d/10i18n/module-setup.sh
@@ -3,6 +3,7 @@
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
 check() {
+    [[ "$mount_needs" ]] && return 1
     return 0
 }
 
diff --git a/modules.d/10rpmversion/module-setup.sh b/modules.d/10rpmversion/module-setup.sh
index 676775f..4c021ad 100755
--- a/modules.d/10rpmversion/module-setup.sh
+++ b/modules.d/10rpmversion/module-setup.sh
@@ -3,6 +3,7 @@
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
 check() {
+    [[ "$mount_needs" ]] && return 1
     [ -f /etc/redhat-release ]
 }
 
diff --git a/modules.d/50plymouth/module-setup.sh b/modules.d/50plymouth/module-setup.sh
index 338371f..0b65ee0 100755
--- a/modules.d/50plymouth/module-setup.sh
+++ b/modules.d/50plymouth/module-setup.sh
@@ -3,6 +3,7 @@
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
 check() {
+    [[ "$mount_needs" ]] && return 1
     [[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
 }
 
diff --git a/modules.d/90btrfs/module-setup.sh b/modules.d/90btrfs/module-setup.sh
index f89713f..53ba3a2 100755
--- a/modules.d/90btrfs/module-setup.sh
+++ b/modules.d/90btrfs/module-setup.sh
@@ -11,7 +11,7 @@ check() {
     . $dracutfunctions
     [[ $debug ]] && set -x
 
-    [[ $hostonly ]] && {
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
         local _found
         for fs in $host_fs_types; do
             [[ "$fs" = "|btrfs" ]] && _found="1"
diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
index 42c6b48..a92c187 100755
--- a/modules.d/90crypt/module-setup.sh
+++ b/modules.d/90crypt/module-setup.sh
@@ -23,7 +23,7 @@ check() {
         echo " rd.luks.uuid=${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
     }
 
-    [[ $hostonly ]] && {
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
         [[ -d "${initdir}/etc/cmdline.d" ]] || mkdir -p "${initdir}/etc/cmdline.d"
         for_each_host_dev_fs check_crypt
         [ -f "${initdir}/etc/cmdline.d/90crypt.conf" ] || return 1
diff --git a/modules.d/90dmraid/module-setup.sh b/modules.d/90dmraid/module-setup.sh
index 9de6c63..19f2ce6 100755
--- a/modules.d/90dmraid/module-setup.sh
+++ b/modules.d/90dmraid/module-setup.sh
@@ -38,7 +38,7 @@ check() {
         echo " rd.dm.uuid=${DM_NAME} " >> "${initdir}/etc/cmdline.d/90dmraid.conf"
     }
 
-    [[ $hostonly ]] && {
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
         [[ -d "${initdir}/etc/cmdline.d" ]] || mkdir -p "${initdir}/etc/cmdline.d"
         for_each_host_dev_fs check_dmraid
         [ -f "${initdir}/etc/cmdline.d/90dmraid.conf" ] || return 1
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index 87751cb..c910f13 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -23,7 +23,7 @@ check() {
         echo " rd.lvm.lv=${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
     }
 
-    [[ $hostonly ]] && {
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
         [[ -d "${initdir}/etc/cmdline.d" ]] || mkdir -p "${initdir}/etc/cmdline.d"
         for_each_host_dev_fs check_lvm
         [ -f "${initdir}/etc/cmdline.d/90lvm.conf" ] || return 1
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index 05e0127..8c3e2bb 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -38,7 +38,7 @@ check() {
         echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf"
     }
 
-    [[ $hostonly ]] && {
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
         [[ -d "${initdir}/etc/cmdline.d" ]] || mkdir -p "${initdir}/etc/cmdline.d"
         for_each_host_dev_fs check_mdraid
         [[ -f "${initdir}/etc/cmdline.d/90mdraid.conf" ]] || return 1
diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh
index b4cee97..e66798b 100755
--- a/modules.d/95fcoe/module-setup.sh
+++ b/modules.d/95fcoe/module-setup.sh
@@ -6,7 +6,7 @@ check() {
     # FIXME
     # If hostonly was requested, fail the check until we have some way of
     # knowing we are booting from FCoE
-    [[ $hostonly ]] && return 1
+    [[ $hostonly ]] || [[ $mount_needs ]] && return 1
 
     return 0
 }
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index bb3b793..641d917 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -7,7 +7,7 @@ check() {
     type -P rpcbind >/dev/null || type -P portmap >/dev/null || return 1
     type -P rpc.statd mount.nfs mount.nfs4 umount >/dev/null || return 1
 
-    [[ $hostonly ]] && {
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
         for fs in ${host_fs_types[@]}; do
             strstr "$fs" "|nfs"  && return 0
             strstr "$fs" "|nfs3" && return 0
diff --git a/modules.d/97biosdevname/module-setup.sh b/modules.d/97biosdevname/module-setup.sh
index 834831f..4d492a9 100755
--- a/modules.d/97biosdevname/module-setup.sh
+++ b/modules.d/97biosdevname/module-setup.sh
@@ -3,6 +3,7 @@
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
 check() {
+    [[ "$mount_needs" ]] && return 1
     type -P biosdevname >/dev/null || return 1
     return 0
 }
diff --git a/modules.d/98usrmount/module-setup.sh b/modules.d/98usrmount/module-setup.sh
index 8f7be10..5844383 100755
--- a/modules.d/98usrmount/module-setup.sh
+++ b/modules.d/98usrmount/module-setup.sh
@@ -3,6 +3,7 @@
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
 check() {
+    [[ $mount_needs ]] && return 1
     return 0
 }
 
-- 
1.7.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/6] Fix get_maj_min() to follow symlink
       [not found] ` <1324361401-6908-1-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2011-12-20  6:09   ` [PATCH 1/6] Allow to add mount points even not in hostonly mode Cong Wang
  2011-12-20  6:09   ` [PATCH 2/6] Check module dependencies of mount points Cong Wang
@ 2011-12-20  6:09   ` Cong Wang
       [not found]     ` <1324361401-6908-4-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2011-12-20  6:09   ` [PATCH 4/6] Pass device name instead of major:minor in for_each_host_dev_fs() Cong Wang
                     ` (2 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Cong Wang @ 2011-12-20  6:09 UTC (permalink / raw)
  To: harald-H+wXaHxf7aLQT0dZR+AlfA; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Otherwise get_maj_min /dev/mapper/vg_cr0-lv_home will return 0:0.

Signed-off-by: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 dracut-functions |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dracut-functions b/dracut-functions
index 54b1c30..618e884 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -180,7 +180,7 @@ get_fs_uuid() (
 
 get_maj_min() {
     local _dev
-    _dev=$(stat -c '$((0x%T)):$((0x%t))' "$1" 2>/dev/null)
+    _dev=$(stat -L -c '$((0x%T)):$((0x%t))' "$1" 2>/dev/null)
     _dev=$(eval "echo $_dev")
     echo $_dev
 }
-- 
1.7.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/6] Pass device name instead of major:minor in for_each_host_dev_fs()
       [not found] ` <1324361401-6908-1-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (2 preceding siblings ...)
  2011-12-20  6:09   ` [PATCH 3/6] Fix get_maj_min() to follow symlink Cong Wang
@ 2011-12-20  6:09   ` Cong Wang
       [not found]     ` <1324361401-6908-5-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2011-12-20  6:10   ` [PATCH 5/6] nfs: fix regex patterns in check() Cong Wang
  2011-12-20  6:10   ` [PATCH 6/6] lvm: pass the correct rd.lvm.lv parameter Cong Wang
  5 siblings, 1 reply; 14+ messages in thread
From: Cong Wang @ 2011-12-20  6:09 UTC (permalink / raw)
  To: harald-H+wXaHxf7aLQT0dZR+AlfA; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Signed-off-by: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 dracut           |   11 +++++------
 dracut-functions |   11 ++++++-----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/dracut b/dracut
index 452067d..85228b8 100755
--- a/dracut
+++ b/dracut
@@ -528,9 +528,8 @@ chmod 755 "$initdir"
 for line in "${fstab_lines[@]}"; do
     set -- $line
     #dev mp fs fsopts
-    dev="$(get_maj_min $1)"
-    push host_devs "${dev:-$1}"
-    push host_fs_types "$dev|$3"
+    push host_devs "$1"
+    push host_fs_types "$1|$3"
 done
 
 for f in $add_fstab; do
@@ -556,13 +555,13 @@ if [[ $hostonly ]]; then
 
     for mp in "${host_mp[@]}"; do
         mountpoint "$mp" >/dev/null 2>&1 || continue
-        push host_devs $(find_block_device "$mp")
+        push host_devs $(readlink -f "/dev/block/$(find_block_device "$mp")")
     done
 fi
 
 _get_fs_type() (
     [[ $1 ]] || return
-    if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then
+    if [[ -b $1 ]] && get_fs_env $1; then
         echo "$1|$ID_FS_TYPE"
         return 1
     fi
@@ -576,7 +575,7 @@ _get_fs_type() (
 for dev in "${host_devs[@]}"; do
     unset fs_type
     for fstype in $(_get_fs_type $dev) \
-        $(check_block_and_slaves _get_fs_type $dev); do
+        $(check_block_and_slaves _get_fs_type $(get_maj_min $dev)); do
         if ! strstr " ${host_fs_types[*]} " " $fstype ";then
             push host_fs_types "$fstype"
         fi
diff --git a/dracut-functions b/dracut-functions
index 618e884..3dd72e9 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -247,16 +247,17 @@ find_root_block_device() { find_block_device /; }
 for_each_host_dev_fs()
 {
     local _func="$1"
+    local _dev
+    local _fs
     for f in ${host_fs_types[@]}; do
         OLDIFS="$IFS"
         IFS="|"
         set -- $f
         IFS="$OLDIFS"
-        dev=$1
-        [[ -b /dev/block/$dev ]] && dev="/dev/block/$dev"
-        [[ -b $dev ]] || continue
-        fs="$2"
-        $_func $dev $fs
+        _dev="$1"
+        [[ -b "$_dev" ]] || continue
+        _fs="$2"
+        $_func $_dev $_fs
     done
 }
 
-- 
1.7.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/6] nfs: fix regex patterns in check()
       [not found] ` <1324361401-6908-1-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (3 preceding siblings ...)
  2011-12-20  6:09   ` [PATCH 4/6] Pass device name instead of major:minor in for_each_host_dev_fs() Cong Wang
@ 2011-12-20  6:10   ` Cong Wang
       [not found]     ` <1324361401-6908-6-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2011-12-20  6:10   ` [PATCH 6/6] lvm: pass the correct rd.lvm.lv parameter Cong Wang
  5 siblings, 1 reply; 14+ messages in thread
From: Cong Wang @ 2011-12-20  6:10 UTC (permalink / raw)
  To: harald-H+wXaHxf7aLQT0dZR+AlfA; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Signed-off-by: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 modules.d/95nfs/module-setup.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index 641d917..6778f28 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -9,9 +9,9 @@ check() {
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
         for fs in ${host_fs_types[@]}; do
-            strstr "$fs" "|nfs"  && return 0
-            strstr "$fs" "|nfs3" && return 0
-            strstr "$fs" "|nfs4" && return 0
+            strstr "$fs" "\|nfs"  && return 0
+            strstr "$fs" "\|nfs3" && return 0
+            strstr "$fs" "\|nfs4" && return 0
         done
         return 255
     }
-- 
1.7.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/6] lvm: pass the correct rd.lvm.lv parameter
       [not found] ` <1324361401-6908-1-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (4 preceding siblings ...)
  2011-12-20  6:10   ` [PATCH 5/6] nfs: fix regex patterns in check() Cong Wang
@ 2011-12-20  6:10   ` Cong Wang
       [not found]     ` <1324361401-6908-7-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  5 siblings, 1 reply; 14+ messages in thread
From: Cong Wang @ 2011-12-20  6:10 UTC (permalink / raw)
  To: harald-H+wXaHxf7aLQT0dZR+AlfA; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

rd.lvm.lv accepts ${DM_VG_NAME}/${DM_LV_NAME}, not ${DM_LV_NAME}.

Signed-off-by: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 modules.d/90lvm/module-setup.sh |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index c910f13..01bfa8a 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -11,16 +11,11 @@ check() {
     [[ $debug ]] && set -x
 
     check_lvm() {
-        local dev=$1
-        DM_LV_NAME=$(udevadm info --query=property --name=$dev \
-            | while read line; do
-                [[ ${line#DM_LV_NAME} = $line ]] && continue
-                eval "$line"
-                echo $DM_LV_NAME
-                break
-                done)
-        [[ ${DM_LV_NAME} ]] || continue
-        echo " rd.lvm.lv=${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
+        unset DM_VG_NAME
+        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"
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-- 
1.7.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/6] Allow to add mount points even not in hostonly mode
       [not found]     ` <1324361401-6908-2-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-01-13 10:25       ` Harald Hoyer
  2012-01-13 10:33       ` Harald Hoyer
  1 sibling, 0 replies; 14+ messages in thread
From: Harald Hoyer @ 2012-01-13 10:25 UTC (permalink / raw)
  To: Cong Wang; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

On 20.12.2011 07:09, Cong Wang wrote:
> From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Don't force --mount only working in hostonly mode, let users decide.
> With this patch, people can still combine -H --mount '...' if they
> want to use it in hostonly mode.
> 
> Signed-off-by: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  dracut |   77 +++++++++++++++++++++++++++++++--------------------------------
>  1 files changed, 38 insertions(+), 39 deletions(-)

applied

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/6] Fix get_maj_min() to follow symlink
       [not found]     ` <1324361401-6908-4-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-01-13 10:25       ` Harald Hoyer
  0 siblings, 0 replies; 14+ messages in thread
From: Harald Hoyer @ 2012-01-13 10:25 UTC (permalink / raw)
  To: Cong Wang; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

On 20.12.2011 07:09, Cong Wang wrote:
> From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Otherwise get_maj_min /dev/mapper/vg_cr0-lv_home will return 0:0.
> 
> Signed-off-by: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  dracut-functions |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 

applied

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/6] Pass device name instead of major:minor in for_each_host_dev_fs()
       [not found]     ` <1324361401-6908-5-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-01-13 10:26       ` Harald Hoyer
  0 siblings, 0 replies; 14+ messages in thread
From: Harald Hoyer @ 2012-01-13 10:26 UTC (permalink / raw)
  To: Cong Wang; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

On 20.12.2011 07:09, Cong Wang wrote:
> From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Signed-off-by: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  dracut           |   11 +++++------
>  dracut-functions |   11 ++++++-----
>  2 files changed, 11 insertions(+), 11 deletions(-)
> 

applied

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/6] nfs: fix regex patterns in check()
       [not found]     ` <1324361401-6908-6-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-01-13 10:26       ` Harald Hoyer
  0 siblings, 0 replies; 14+ messages in thread
From: Harald Hoyer @ 2012-01-13 10:26 UTC (permalink / raw)
  To: Cong Wang; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

On 20.12.2011 07:10, Cong Wang wrote:
> From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Signed-off-by: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  modules.d/95nfs/module-setup.sh |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 

applied

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 6/6] lvm: pass the correct rd.lvm.lv parameter
       [not found]     ` <1324361401-6908-7-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-01-13 10:27       ` Harald Hoyer
  0 siblings, 0 replies; 14+ messages in thread
From: Harald Hoyer @ 2012-01-13 10:27 UTC (permalink / raw)
  To: Cong Wang; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

On 20.12.2011 07:10, Cong Wang wrote:
> From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> rd.lvm.lv accepts ${DM_VG_NAME}/${DM_LV_NAME}, not ${DM_LV_NAME}.
> 
> Signed-off-by: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

applied

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/6] Allow to add mount points even not in hostonly mode
       [not found]     ` <1324361401-6908-2-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2012-01-13 10:25       ` Harald Hoyer
@ 2012-01-13 10:33       ` Harald Hoyer
  1 sibling, 0 replies; 14+ messages in thread
From: Harald Hoyer @ 2012-01-13 10:33 UTC (permalink / raw)
  To: Cong Wang; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

On 20.12.2011 07:09, Cong Wang wrote:
> From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Don't force --mount only working in hostonly mode, let users decide.
> With this patch, people can still combine -H --mount '...' if they
> want to use it in hostonly mode.
> 
> Signed-off-by: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

applied

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/6] Check module dependencies of mount points
       [not found]     ` <1324361401-6908-3-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-01-13 10:36       ` Harald Hoyer
  0 siblings, 0 replies; 14+ messages in thread
From: Harald Hoyer @ 2012-01-13 10:36 UTC (permalink / raw)
  To: Cong Wang; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Cong Wang

On 20.12.2011 07:09, Cong Wang wrote:
> From: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Like -H, we need to poll every module to check if it is needed
> to mount a specific device in '--mount'.
> 
> Signed-off-by: Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

applied

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-01-13 10:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-20  6:09 [PATCH 0/6] Enhancements and bug fixes for --mount Cong Wang
     [not found] ` <1324361401-6908-1-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-12-20  6:09   ` [PATCH 1/6] Allow to add mount points even not in hostonly mode Cong Wang
     [not found]     ` <1324361401-6908-2-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-01-13 10:25       ` Harald Hoyer
2012-01-13 10:33       ` Harald Hoyer
2011-12-20  6:09   ` [PATCH 2/6] Check module dependencies of mount points Cong Wang
     [not found]     ` <1324361401-6908-3-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-01-13 10:36       ` Harald Hoyer
2011-12-20  6:09   ` [PATCH 3/6] Fix get_maj_min() to follow symlink Cong Wang
     [not found]     ` <1324361401-6908-4-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-01-13 10:25       ` Harald Hoyer
2011-12-20  6:09   ` [PATCH 4/6] Pass device name instead of major:minor in for_each_host_dev_fs() Cong Wang
     [not found]     ` <1324361401-6908-5-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-01-13 10:26       ` Harald Hoyer
2011-12-20  6:10   ` [PATCH 5/6] nfs: fix regex patterns in check() Cong Wang
     [not found]     ` <1324361401-6908-6-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-01-13 10:26       ` Harald Hoyer
2011-12-20  6:10   ` [PATCH 6/6] lvm: pass the correct rd.lvm.lv parameter Cong Wang
     [not found]     ` <1324361401-6908-7-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-01-13 10:27       ` Harald Hoyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.