All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 0/3] add --device option
@ 2012-08-17 12:35 dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2012-08-17 12:35 ` [patch 1/3] wait host devs in base module dyoung-H+wXaHxf7aLQT0dZR+AlfA
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2012-08-17 12:35 UTC (permalink / raw)
  To: vgoyal-H+wXaHxf7aLQT0dZR+AlfA, chaowang-H+wXaHxf7aLQT0dZR+AlfA,
	harald-H+wXaHxf7aLQT0dZR+AlfA, initramfs-u79uwXL29TY76Z2rM5mHXA

This is the update patch series for --device option.
1/3: wait host devs in base module
2/3: Add for_each_host_dev for device only checking
3/3: Add a dracut option --device to bring up a device in initramfs
---
 dracut-functions.sh                     |   15 +++++++++++++++
 dracut.8.asc                            |    3 +++
 dracut.sh                               |   22 ++++++++++++++++++++++
 modules.d/90lvm/module-setup.sh         |    2 +-
 modules.d/90multipath/module-setup.sh   |    2 +-
 modules.d/95fstab-sys/module-setup.sh   |    1 -
 modules.d/95fstab-sys/wait-mount-dev.sh |   22 ----------------------
 modules.d/95iscsi/module-setup.sh       |    2 +-
 modules.d/99base/module-setup.sh        |    1 +
 modules.d/99base/wait-host-devs.sh      |   20 ++++++++++++++++++++
 10 files changed, 64 insertions(+), 26 deletions(-)

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

* [patch 1/3] wait host devs in base module
  2012-08-17 12:35 [patch 0/3] add --device option dyoung-H+wXaHxf7aLQT0dZR+AlfA
@ 2012-08-17 12:35 ` dyoung-H+wXaHxf7aLQT0dZR+AlfA
       [not found]   ` <20120817123905.089958024-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2012-08-17 12:35 ` [patch 2/3] Add for_each_host_dev for device only checking dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2012-08-17 12:35 ` [patch 3/3] Add a dracut option --device to bring up a device in initramfs dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2 siblings, 1 reply; 12+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2012-08-17 12:35 UTC (permalink / raw)
  To: vgoyal-H+wXaHxf7aLQT0dZR+AlfA, chaowang-H+wXaHxf7aLQT0dZR+AlfA,
	harald-H+wXaHxf7aLQT0dZR+AlfA, initramfs-u79uwXL29TY76Z2rM5mHXA
  Cc: Dave Young

[-- Attachment #1: 0816-1-wait-host-devs.patch --]
[-- Type: text/plain, Size: 3692 bytes --]

each dev in host_devs[] should be waited in initqueue to make sure they
are oneline before initqueue finish.

Add a new wait_host_devs.sh in base module to make this a generic thing.
Because all the devs in fstab lines are also added to host_devs, so no need
do same wait in fstab-sys module anymore.

Chaowang: add slave devices to host_devs as well.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 dracut.sh                               |   19 +++++++++++++++++++
 modules.d/95fstab-sys/module-setup.sh   |    1 -
 modules.d/95fstab-sys/wait-mount-dev.sh |   22 ----------------------
 modules.d/99base/module-setup.sh        |    1 +
 modules.d/99base/wait-host-devs.sh      |   20 ++++++++++++++++++++
 5 files changed, 40 insertions(+), 23 deletions(-)

--- dracut.orig/dracut.sh
+++ dracut/dracut.sh
@@ -769,6 +769,20 @@ for dev in "${host_devs[@]}"; do
     done
 done
 
+_get_block_dev() {
+    echo `readlink -f /dev/block/$1`; return 1;
+}
+
+for dev in "${host_devs[@]}"; do
+    unset _dev
+    for _dev in $(check_block_and_slaves _get_block_dev $(get_maj_min $dev)); do
+       [ -b "$_dev" ] || continue
+        if ! strstr " ${host_devs[*]} " " $_dev ";then
+            push host_devs "$_dev"
+        fi
+    done
+done
+
 [[ -d $udevdir ]] \
     || udevdir=$(pkg-config udev --variable=udevdir 2>/dev/null)
 if ! [[ -d "$udevdir" ]]; then
@@ -903,6 +917,11 @@ done
 
 dinfo "*** Including modules done ***"
 
+## save host_devs which we need bring up
+for _dev in ${host_devs[@]}; do
+    echo $_dev >> $initdir/etc/host_devs
+done
+
 ## final stuff that has to happen
 if [[ $no_kernel != yes ]]; then
 
--- dracut.orig/modules.d/95fstab-sys/module-setup.sh
+++ dracut/modules.d/95fstab-sys/module-setup.sh
@@ -13,5 +13,4 @@ depends() {
 install() {
     [ -f /etc/fstab.sys ] && inst_simple /etc/fstab.sys
     inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
-    inst_hook cmdline 00 "$moddir/wait-mount-dev.sh"
 }
--- dracut.orig/modules.d/95fstab-sys/wait-mount-dev.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
-
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh
-
-fstab_wait_dev() {
-    local _dev _mp _fs _opts _dump _pass _rest
-    test -e "$1" || return 1
-    while read _dev _mp _fs _opts _dump _pass _rest; do
-        [ -z "${_dev%%#*}" ] && continue # Skip comment lines
-        case "$_dev" in
-        /dev/?*)
-            wait_for_dev $_dev;;
-        *) ;;
-        esac
-    done < $1
-    return 0
-}
-
-[ -f /etc/fstab ] && fstab_wait_dev /etc/fstab
--- dracut.orig/modules.d/99base/module-setup.sh
+++ dracut/modules.d/99base/module-setup.sh
@@ -41,6 +41,7 @@ install() {
     dracut_install switch_root || dfatal "Failed to install switch_root"
 
     inst_simple "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
+    inst_hook cmdline 00 "$moddir/wait-host-devs.sh"
     inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
     mkdir -p "${initdir}/var"
     [ -x /lib/systemd/systemd-timestamp ] && inst /lib/systemd/systemd-timestamp
--- /dev/null
+++ dracut/modules.d/99base/wait-host-devs.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
+wait_host_devs() {
+    local _dev
+
+    while read _dev; do
+        case "$_dev" in
+        /dev/?*)
+            wait_for_dev $_dev
+            ;;
+        *) ;;
+        esac
+    done < $1
+}
+
+[ -f /etc/host_devs ] && wait_host_devs /etc/host_devs

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

* [patch 2/3] Add for_each_host_dev for device only checking
  2012-08-17 12:35 [patch 0/3] add --device option dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2012-08-17 12:35 ` [patch 1/3] wait host devs in base module dyoung-H+wXaHxf7aLQT0dZR+AlfA
@ 2012-08-17 12:35 ` dyoung-H+wXaHxf7aLQT0dZR+AlfA
       [not found]   ` <20120817123905.206266546-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2012-08-17 12:35 ` [patch 3/3] Add a dracut option --device to bring up a device in initramfs dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2 siblings, 1 reply; 12+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2012-08-17 12:35 UTC (permalink / raw)
  To: vgoyal-H+wXaHxf7aLQT0dZR+AlfA, chaowang-H+wXaHxf7aLQT0dZR+AlfA,
	harald-H+wXaHxf7aLQT0dZR+AlfA, initramfs-u79uwXL29TY76Z2rM5mHXA
  Cc: Dave Young

[-- Attachment #1: 0816-2-add-for-each-dev.patch --]
[-- Type: text/plain, Size: 2227 bytes --]

For lvm, multipath, iscsi modules they do not care about the filesystem,
Also there could be devcie in host_devs but it does not get formated.

For these kind of modules, use for_each_host_dev will be better than use
for_each_host_dev_fs, here add a new function to iterate the host_devs.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 dracut-functions.sh                   |   15 +++++++++++++++
 modules.d/90lvm/module-setup.sh       |    2 +-
 modules.d/90multipath/module-setup.sh |    2 +-
 modules.d/95iscsi/module-setup.sh     |    2 +-
 4 files changed, 18 insertions(+), 3 deletions(-)

--- dracut.orig/dracut-functions.sh
+++ dracut/dracut-functions.sh
@@ -387,6 +387,21 @@ find_mp_fstype() {
 # finds the major:minor of the block device backing the root filesystem.
 find_root_block_device() { find_block_device /; }
 
+# for_each_host_dev <func>
+# Execute "<func> <dev>" for every "<dev>" found
+# in ${host_devs[@]}
+for_each_host_dev()
+{
+    local _func="$1"
+    local _dev
+    local _ret=1
+    for _dev in ${host_devs[@]}; do
+        [[ -b "$_dev" ]] || continue
+        $_func $_dev && _ret=0
+    done
+    return $_ret
+}
+
 # for_each_host_dev_fs <func>
 # Execute "<func> <dev> <filesystem>" for every "<dev>|<fs>" pair found
 # in ${host_fs_types[@]}
--- dracut.orig/modules.d/90lvm/module-setup.sh
+++ dracut/modules.d/90lvm/module-setup.sh
@@ -22,7 +22,7 @@ check() {
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs check_lvm || return 1
+        for_each_host_dev check_lvm || return 1
     }
 
     return 0
--- dracut.orig/modules.d/90multipath/module-setup.sh
+++ dracut/modules.d/90multipath/module-setup.sh
@@ -16,7 +16,7 @@ check() {
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs is_mpath || return 1
+        for_each_host_dev is_mpath || return 1
     }
 
     return 0
--- dracut.orig/modules.d/95iscsi/module-setup.sh
+++ dracut/modules.d/95iscsi/module-setup.sh
@@ -23,7 +23,7 @@ check() {
     )
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs is_iscsi || return 1
+        for_each_host_dev is_iscsi || return 1
     }
     return 0
 }

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

* [patch 3/3] Add a dracut option --device to bring up a device in initramfs
  2012-08-17 12:35 [patch 0/3] add --device option dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2012-08-17 12:35 ` [patch 1/3] wait host devs in base module dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2012-08-17 12:35 ` [patch 2/3] Add for_each_host_dev for device only checking dyoung-H+wXaHxf7aLQT0dZR+AlfA
@ 2012-08-17 12:35 ` dyoung-H+wXaHxf7aLQT0dZR+AlfA
       [not found]   ` <20120817123905.353853040-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2 siblings, 1 reply; 12+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2012-08-17 12:35 UTC (permalink / raw)
  To: vgoyal-H+wXaHxf7aLQT0dZR+AlfA, chaowang-H+wXaHxf7aLQT0dZR+AlfA,
	harald-H+wXaHxf7aLQT0dZR+AlfA, initramfs-u79uwXL29TY76Z2rM5mHXA
  Cc: Dave Young

[-- Attachment #1: 0816-3-add-raw-device.patch --]
[-- Type: TEXT/PLAIN, Size: 2311 bytes --]

Kdump support dump to raw device which could be on top of complex storage
such as multipath and iscsi which are standalone dracut modules.

Add a --device option to dracut which will add the device to host_devs so
dracut can add the dependent modules automaticlly and enable them in initramfs.

--device will accept device node name as the param.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Tested-by: Chao Wang <chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 dracut.8.asc |    3 +++
 dracut.sh    |    3 +++
 2 files changed, 6 insertions(+)

--- dracut.orig/dracut.sh
+++ dracut/dracut.sh
@@ -133,6 +133,7 @@ Creates initial ramdisk images for prelo
   --mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
                         Mount device [DEV] on mountpoint [MP] with filesystem
                         [FSTYPE] and options [FSOPTS] in the initramfs
+  --device "[DEV]"      Bring up [DEV] in initramfs
   -i, --include [SOURCE] [TARGET]
                         Include the files in the SOURCE directory into the
                          Target directory in the final initramfs.
@@ -261,6 +262,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
     --long fscks: \
     --long add-fstab: \
     --long mount: \
+    --long device: \
     --long nofscks: \
     --long ro-mnt \
     --long kmoddir: \
@@ -327,6 +329,7 @@ while :; do
         --fscks)       push fscks_l              "$2"; shift;;
         --add-fstab)   push add_fstab_l          "$2"; shift;;
         --mount)       push fstab_lines          "$2"; shift;;
+        --device)      push host_devs            "$2"; shift;;
         --nofscks)     nofscks_l="yes";;
         --ro-mnt)      ro_mnt_l="yes";;
         -k|--kmoddir)  drivers_dir_l="$2"; shift;;
--- dracut.orig/dracut.8.asc
+++ dracut/dracut.8.asc
@@ -321,6 +321,9 @@ provide a valid _/etc/fstab_.
     Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
     options>_ in the initramfs
 
+**--device** _<device>_ ::
+    Bring up _<device>_ in initramfs, _<device>_ should be the device name
+
 **-i, --include** _<SOURCE>_ _<TARGET>_::
     include the files in the SOURCE directory into the
     TARGET directory in the final initramfs. If SOURCE is a file, it will be

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

* Re: [patch 1/3] wait host devs in base module
       [not found]   ` <20120817123905.089958024-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-08-17 16:57     ` Vivek Goyal
       [not found]       ` <20120817165709.GA11604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Vivek Goyal @ 2012-08-17 16:57 UTC (permalink / raw)
  To: dyoung-H+wXaHxf7aLQT0dZR+AlfA
  Cc: chaowang-H+wXaHxf7aLQT0dZR+AlfA, harald-H+wXaHxf7aLQT0dZR+AlfA,
	initramfs-u79uwXL29TY76Z2rM5mHXA

On Fri, Aug 17, 2012 at 08:35:20PM +0800, dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:
> each dev in host_devs[] should be waited in initqueue to make sure they
> are oneline before initqueue finish.
> 
> Add a new wait_host_devs.sh in base module to make this a generic thing.
> Because all the devs in fstab lines are also added to host_devs, so no need
> do same wait in fstab-sys module anymore.
> 
> Chaowang: add slave devices to host_devs as well.

Why should we wait for slave devices? If slave device does not come up,
top level device will not come up anyway. So I don't think we should wait
for slave devices.

Secondly, trying to list slave devices is dangerous as the names you
seem to be stroing are not persistent and device renaming will hang
the system.

So whereever you are waiting for a device to come up, make sure you
are using persistent device name as generated by udev.

Thanks
Vivek

> 
> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  dracut.sh                               |   19 +++++++++++++++++++
>  modules.d/95fstab-sys/module-setup.sh   |    1 -
>  modules.d/95fstab-sys/wait-mount-dev.sh |   22 ----------------------
>  modules.d/99base/module-setup.sh        |    1 +
>  modules.d/99base/wait-host-devs.sh      |   20 ++++++++++++++++++++
>  5 files changed, 40 insertions(+), 23 deletions(-)
> 
> --- dracut.orig/dracut.sh
> +++ dracut/dracut.sh
> @@ -769,6 +769,20 @@ for dev in "${host_devs[@]}"; do
>      done
>  done
>  
> +_get_block_dev() {
> +    echo `readlink -f /dev/block/$1`; return 1;
> +}
> +
> +for dev in "${host_devs[@]}"; do
> +    unset _dev
> +    for _dev in $(check_block_and_slaves _get_block_dev $(get_maj_min $dev)); do
> +       [ -b "$_dev" ] || continue
> +        if ! strstr " ${host_devs[*]} " " $_dev ";then
> +            push host_devs "$_dev"
> +        fi
> +    done
> +done
> +
>  [[ -d $udevdir ]] \
>      || udevdir=$(pkg-config udev --variable=udevdir 2>/dev/null)
>  if ! [[ -d "$udevdir" ]]; then
> @@ -903,6 +917,11 @@ done
>  
>  dinfo "*** Including modules done ***"
>  
> +## save host_devs which we need bring up
> +for _dev in ${host_devs[@]}; do
> +    echo $_dev >> $initdir/etc/host_devs
> +done
> +
>  ## final stuff that has to happen
>  if [[ $no_kernel != yes ]]; then
>  
> --- dracut.orig/modules.d/95fstab-sys/module-setup.sh
> +++ dracut/modules.d/95fstab-sys/module-setup.sh
> @@ -13,5 +13,4 @@ depends() {
>  install() {
>      [ -f /etc/fstab.sys ] && inst_simple /etc/fstab.sys
>      inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
> -    inst_hook cmdline 00 "$moddir/wait-mount-dev.sh"
>  }
> --- dracut.orig/modules.d/95fstab-sys/wait-mount-dev.sh
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -#!/bin/sh
> -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
> -# ex: ts=8 sw=4 sts=4 et filetype=sh
> -
> -type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
> -type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh
> -
> -fstab_wait_dev() {
> -    local _dev _mp _fs _opts _dump _pass _rest
> -    test -e "$1" || return 1
> -    while read _dev _mp _fs _opts _dump _pass _rest; do
> -        [ -z "${_dev%%#*}" ] && continue # Skip comment lines
> -        case "$_dev" in
> -        /dev/?*)
> -            wait_for_dev $_dev;;
> -        *) ;;
> -        esac
> -    done < $1
> -    return 0
> -}
> -
> -[ -f /etc/fstab ] && fstab_wait_dev /etc/fstab
> --- dracut.orig/modules.d/99base/module-setup.sh
> +++ dracut/modules.d/99base/module-setup.sh
> @@ -41,6 +41,7 @@ install() {
>      dracut_install switch_root || dfatal "Failed to install switch_root"
>  
>      inst_simple "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
> +    inst_hook cmdline 00 "$moddir/wait-host-devs.sh"
>      inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
>      mkdir -p "${initdir}/var"
>      [ -x /lib/systemd/systemd-timestamp ] && inst /lib/systemd/systemd-timestamp
> --- /dev/null
> +++ dracut/modules.d/99base/wait-host-devs.sh
> @@ -0,0 +1,20 @@
> +#!/bin/sh
> +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
> +# ex: ts=8 sw=4 sts=4 et filetype=sh
> +
> +type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
> +
> +wait_host_devs() {
> +    local _dev
> +
> +    while read _dev; do
> +        case "$_dev" in
> +        /dev/?*)
> +            wait_for_dev $_dev
> +            ;;
> +        *) ;;
> +        esac
> +    done < $1
> +}
> +
> +[ -f /etc/host_devs ] && wait_host_devs /etc/host_devs

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

* Re: [patch 2/3] Add for_each_host_dev for device only checking
       [not found]   ` <20120817123905.206266546-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-08-17 17:02     ` Vivek Goyal
       [not found]       ` <20120817170217.GB11604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Vivek Goyal @ 2012-08-17 17:02 UTC (permalink / raw)
  To: dyoung-H+wXaHxf7aLQT0dZR+AlfA
  Cc: chaowang-H+wXaHxf7aLQT0dZR+AlfA, harald-H+wXaHxf7aLQT0dZR+AlfA,
	initramfs-u79uwXL29TY76Z2rM5mHXA

On Fri, Aug 17, 2012 at 08:35:21PM +0800, dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:
> For lvm, multipath, iscsi modules they do not care about the filesystem,
> Also there could be devcie in host_devs but it does not get formated.
> 
> For these kind of modules, use for_each_host_dev will be better than use
> for_each_host_dev_fs, here add a new function to iterate the host_devs.
> 

If we decide not to add slave devices in host_devs, then this will not
work.

Vivek

> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  dracut-functions.sh                   |   15 +++++++++++++++
>  modules.d/90lvm/module-setup.sh       |    2 +-
>  modules.d/90multipath/module-setup.sh |    2 +-
>  modules.d/95iscsi/module-setup.sh     |    2 +-
>  4 files changed, 18 insertions(+), 3 deletions(-)
> 
> --- dracut.orig/dracut-functions.sh
> +++ dracut/dracut-functions.sh
> @@ -387,6 +387,21 @@ find_mp_fstype() {
>  # finds the major:minor of the block device backing the root filesystem.
>  find_root_block_device() { find_block_device /; }
>  
> +# for_each_host_dev <func>
> +# Execute "<func> <dev>" for every "<dev>" found
> +# in ${host_devs[@]}
> +for_each_host_dev()
> +{
> +    local _func="$1"
> +    local _dev
> +    local _ret=1
> +    for _dev in ${host_devs[@]}; do
> +        [[ -b "$_dev" ]] || continue
> +        $_func $_dev && _ret=0
> +    done
> +    return $_ret
> +}
> +
>  # for_each_host_dev_fs <func>
>  # Execute "<func> <dev> <filesystem>" for every "<dev>|<fs>" pair found
>  # in ${host_fs_types[@]}
> --- dracut.orig/modules.d/90lvm/module-setup.sh
> +++ dracut/modules.d/90lvm/module-setup.sh
> @@ -22,7 +22,7 @@ check() {
>      }
>  
>      [[ $hostonly ]] || [[ $mount_needs ]] && {
> -        for_each_host_dev_fs check_lvm || return 1
> +        for_each_host_dev check_lvm || return 1
>      }
>  
>      return 0
> --- dracut.orig/modules.d/90multipath/module-setup.sh
> +++ dracut/modules.d/90multipath/module-setup.sh
> @@ -16,7 +16,7 @@ check() {
>      }
>  
>      [[ $hostonly ]] || [[ $mount_needs ]] && {
> -        for_each_host_dev_fs is_mpath || return 1
> +        for_each_host_dev is_mpath || return 1
>      }
>  
>      return 0
> --- dracut.orig/modules.d/95iscsi/module-setup.sh
> +++ dracut/modules.d/95iscsi/module-setup.sh
> @@ -23,7 +23,7 @@ check() {
>      )
>  
>      [[ $hostonly ]] || [[ $mount_needs ]] && {
> -        for_each_host_dev_fs is_iscsi || return 1
> +        for_each_host_dev is_iscsi || return 1
>      }
>      return 0
>  }

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

* Re: [patch 3/3] Add a dracut option --device to bring up a device in initramfs
       [not found]   ` <20120817123905.353853040-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-08-17 17:04     ` Vivek Goyal
  0 siblings, 0 replies; 12+ messages in thread
From: Vivek Goyal @ 2012-08-17 17:04 UTC (permalink / raw)
  To: dyoung-H+wXaHxf7aLQT0dZR+AlfA
  Cc: chaowang-H+wXaHxf7aLQT0dZR+AlfA, harald-H+wXaHxf7aLQT0dZR+AlfA,
	initramfs-u79uwXL29TY76Z2rM5mHXA

On Fri, Aug 17, 2012 at 08:35:22PM +0800, dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:
> Kdump support dump to raw device which could be on top of complex storage
> such as multipath and iscsi which are standalone dracut modules.
> 
> Add a --device option to dracut which will add the device to host_devs so
> dracut can add the dependent modules automaticlly and enable them in initramfs.
> 
> --device will accept device node name as the param.

Last time you mentioned that device should be device node as /dev/sda. I
think that can fail due to device renaming.

So make sure to specify here that device name here should be persistent
device name as generated by udev. (/dev/disk/by-id/* or /dev/disk/by-uuid/*).

Thanks
Vivek

> 
> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Tested-by: Chao Wang <chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  dracut.8.asc |    3 +++
>  dracut.sh    |    3 +++
>  2 files changed, 6 insertions(+)
> 
> --- dracut.orig/dracut.sh
> +++ dracut/dracut.sh
> @@ -133,6 +133,7 @@ Creates initial ramdisk images for prelo
>    --mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
>                          Mount device [DEV] on mountpoint [MP] with filesystem
>                          [FSTYPE] and options [FSOPTS] in the initramfs
> +  --device "[DEV]"      Bring up [DEV] in initramfs
>    -i, --include [SOURCE] [TARGET]
>                          Include the files in the SOURCE directory into the
>                           Target directory in the final initramfs.
> @@ -261,6 +262,7 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \
>      --long fscks: \
>      --long add-fstab: \
>      --long mount: \
> +    --long device: \
>      --long nofscks: \
>      --long ro-mnt \
>      --long kmoddir: \
> @@ -327,6 +329,7 @@ while :; do
>          --fscks)       push fscks_l              "$2"; shift;;
>          --add-fstab)   push add_fstab_l          "$2"; shift;;
>          --mount)       push fstab_lines          "$2"; shift;;
> +        --device)      push host_devs            "$2"; shift;;
>          --nofscks)     nofscks_l="yes";;
>          --ro-mnt)      ro_mnt_l="yes";;
>          -k|--kmoddir)  drivers_dir_l="$2"; shift;;
> --- dracut.orig/dracut.8.asc
> +++ dracut/dracut.8.asc
> @@ -321,6 +321,9 @@ provide a valid _/etc/fstab_.
>      Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
>      options>_ in the initramfs
>  
> +**--device** _<device>_ ::
> +    Bring up _<device>_ in initramfs, _<device>_ should be the device name
> +
>  **-i, --include** _<SOURCE>_ _<TARGET>_::
>      include the files in the SOURCE directory into the
>      TARGET directory in the final initramfs. If SOURCE is a file, it will be

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

* Re: [patch 1/3] wait host devs in base module
       [not found]       ` <20120817165709.GA11604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-08-20  5:53         ` Dave Young
       [not found]           ` <5031D0ED.4070901-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Dave Young @ 2012-08-20  5:53 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: chaowang-H+wXaHxf7aLQT0dZR+AlfA, harald-H+wXaHxf7aLQT0dZR+AlfA,
	initramfs-u79uwXL29TY76Z2rM5mHXA

On 08/18/2012 12:57 AM, Vivek Goyal wrote:

> On Fri, Aug 17, 2012 at 08:35:20PM +0800, dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:
>> each dev in host_devs[] should be waited in initqueue to make sure they
>> are oneline before initqueue finish.
>>
>> Add a new wait_host_devs.sh in base module to make this a generic thing.
>> Because all the devs in fstab lines are also added to host_devs, so no need
>> do same wait in fstab-sys module anymore.
>>
>> Chaowang: add slave devices to host_devs as well.
> 
> Why should we wait for slave devices? If slave device does not come up,
> top level device will not come up anyway. So I don't think we should wait
> for slave devices.


Yes, agree. Adding the slaves is only for patch 2/3, ie. is_scsi with
for_each_host_dev. I think I do not fully understand the relations
beteen the master and slave devices of iscsi/multipath/etc.


> 
> Secondly, trying to list slave devices is dangerous as the names you
> seem to be stroing are not persistent and device renaming will hang
> the system.
> 
> So whereever you are waiting for a device to come up, make sure you
> are using persistent device name as generated by udev.


Agree too, this is a problem. Looking at the fstab-sys
wait_mount_dev.sh, there's same issue if the dev name in fstab is not
the "persistent device name"

> 
> Thanks
> Vivek
> 

-- 
Thanks
Dave

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

* Re: [patch 2/3] Add for_each_host_dev for device only checking
       [not found]       ` <20120817170217.GB11604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-08-20  5:56         ` Dave Young
       [not found]           ` <5031D18B.2070208-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Dave Young @ 2012-08-20  5:56 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: chaowang-H+wXaHxf7aLQT0dZR+AlfA, harald-H+wXaHxf7aLQT0dZR+AlfA,
	initramfs-u79uwXL29TY76Z2rM5mHXA

On 08/18/2012 01:02 AM, Vivek Goyal wrote:

> On Fri, Aug 17, 2012 at 08:35:21PM +0800, dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:
>> For lvm, multipath, iscsi modules they do not care about the filesystem,
>> Also there could be devcie in host_devs but it does not get formated.
>>
>> For these kind of modules, use for_each_host_dev will be better than use
>> for_each_host_dev_fs, here add a new function to iterate the host_devs.
>>
> 
> If we decide not to add slave devices in host_devs, then this will not
> work.


If we add a line in fstab, then the dev|fs are added to host_fs_types.
What I'm confusing now is why the for_each_host_dev_fs works without the
slave devices in host_fs_types.

> 
> Vivek
> 


-- 
Thanks
Dave

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

* Re: [patch 2/3] Add for_each_host_dev for device only checking
       [not found]           ` <5031D18B.2070208-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-08-20 14:56             ` Vivek Goyal
  0 siblings, 0 replies; 12+ messages in thread
From: Vivek Goyal @ 2012-08-20 14:56 UTC (permalink / raw)
  To: Dave Young
  Cc: chaowang-H+wXaHxf7aLQT0dZR+AlfA, harald-H+wXaHxf7aLQT0dZR+AlfA,
	initramfs-u79uwXL29TY76Z2rM5mHXA

On Mon, Aug 20, 2012 at 01:56:27PM +0800, Dave Young wrote:
> On 08/18/2012 01:02 AM, Vivek Goyal wrote:
> 
> > On Fri, Aug 17, 2012 at 08:35:21PM +0800, dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:
> >> For lvm, multipath, iscsi modules they do not care about the filesystem,
> >> Also there could be devcie in host_devs but it does not get formated.
> >>
> >> For these kind of modules, use for_each_host_dev will be better than use
> >> for_each_host_dev_fs, here add a new function to iterate the host_devs.
> >>
> > 
> > If we decide not to add slave devices in host_devs, then this will not
> > work.
> 
> 
> If we add a line in fstab, then the dev|fs are added to host_fs_types.
> What I'm confusing now is why the for_each_host_dev_fs works without the
> slave devices in host_fs_types.

Because if slave devices have not come up, top level devices in the stack
will not come up. (I think multipath might be exception here).

So I think it should be sufficient to wait for top level block deivce to
come up.

Thanks
Vivek

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

* Re: [patch 1/3] wait host devs in base module
       [not found]           ` <5031D0ED.4070901-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-08-20 14:59             ` Vivek Goyal
       [not found]               ` <20120820145946.GD31044-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Vivek Goyal @ 2012-08-20 14:59 UTC (permalink / raw)
  To: Dave Young
  Cc: chaowang-H+wXaHxf7aLQT0dZR+AlfA, harald-H+wXaHxf7aLQT0dZR+AlfA,
	initramfs-u79uwXL29TY76Z2rM5mHXA

On Mon, Aug 20, 2012 at 01:53:49PM +0800, Dave Young wrote:
> On 08/18/2012 12:57 AM, Vivek Goyal wrote:
> 
> > On Fri, Aug 17, 2012 at 08:35:20PM +0800, dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:
> >> each dev in host_devs[] should be waited in initqueue to make sure they
> >> are oneline before initqueue finish.
> >>
> >> Add a new wait_host_devs.sh in base module to make this a generic thing.
> >> Because all the devs in fstab lines are also added to host_devs, so no need
> >> do same wait in fstab-sys module anymore.
> >>
> >> Chaowang: add slave devices to host_devs as well.
> > 
> > Why should we wait for slave devices? If slave device does not come up,
> > top level device will not come up anyway. So I don't think we should wait
> > for slave devices.
> 
> 
> Yes, agree. Adding the slaves is only for patch 2/3, ie. is_scsi with
> for_each_host_dev. I think I do not fully understand the relations
> beteen the master and slave devices of iscsi/multipath/etc.
> 
> 
> > 
> > Secondly, trying to list slave devices is dangerous as the names you
> > seem to be stroing are not persistent and device renaming will hang
> > the system.
> > 
> > So whereever you are waiting for a device to come up, make sure you
> > are using persistent device name as generated by udev.
> 
> 
> Agree too, this is a problem. Looking at the fstab-sys
> wait_mount_dev.sh, there's same issue if the dev name in fstab is not
> the "persistent device name"

Non persistent names in /etc/fstab will not make sense as system will
be broken across reboots. So it is a requirement to put persistent
names only in /etc/fstab.

I think last time I did partial patch to wait for device nodes. But we
still need mechanism to convert UUID= and LABEL= into respective
persistent device names. Can you please take care of that too while you
are at it.

Thanks
Vivek

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

* Re: [patch 1/3] wait host devs in base module
       [not found]               ` <20120820145946.GD31044-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-08-21  7:32                 ` Dave Young
  0 siblings, 0 replies; 12+ messages in thread
From: Dave Young @ 2012-08-21  7:32 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: chaowang-H+wXaHxf7aLQT0dZR+AlfA, harald-H+wXaHxf7aLQT0dZR+AlfA,
	initramfs-u79uwXL29TY76Z2rM5mHXA

On 08/20/2012 10:59 PM, Vivek Goyal wrote:

[snip]
>>>
>>> So whereever you are waiting for a device to come up, make sure you
>>> are using persistent device name as generated by udev.
>>
>>
>> Agree too, this is a problem. Looking at the fstab-sys
>> wait_mount_dev.sh, there's same issue if the dev name in fstab is not
>> the "persistent device name"
> 
> Non persistent names in /etc/fstab will not make sense as system will
> be broken across reboots. So it is a requirement to put persistent
> names only in /etc/fstab.
> 
> I think last time I did partial patch to wait for device nodes. But we
> still need mechanism to convert UUID= and LABEL= into respective
> persistent device names. Can you please take care of that too while you
> are at it.


will fix this in the update patch set.

> 
> Thanks
> Vivek



-- 
Thanks
Dave

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

end of thread, other threads:[~2012-08-21  7:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-17 12:35 [patch 0/3] add --device option dyoung-H+wXaHxf7aLQT0dZR+AlfA
2012-08-17 12:35 ` [patch 1/3] wait host devs in base module dyoung-H+wXaHxf7aLQT0dZR+AlfA
     [not found]   ` <20120817123905.089958024-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-17 16:57     ` Vivek Goyal
     [not found]       ` <20120817165709.GA11604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-20  5:53         ` Dave Young
     [not found]           ` <5031D0ED.4070901-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-20 14:59             ` Vivek Goyal
     [not found]               ` <20120820145946.GD31044-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-21  7:32                 ` Dave Young
2012-08-17 12:35 ` [patch 2/3] Add for_each_host_dev for device only checking dyoung-H+wXaHxf7aLQT0dZR+AlfA
     [not found]   ` <20120817123905.206266546-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-17 17:02     ` Vivek Goyal
     [not found]       ` <20120817170217.GB11604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-20  5:56         ` Dave Young
     [not found]           ` <5031D18B.2070208-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-20 14:56             ` Vivek Goyal
2012-08-17 12:35 ` [patch 3/3] Add a dracut option --device to bring up a device in initramfs dyoung-H+wXaHxf7aLQT0dZR+AlfA
     [not found]   ` <20120817123905.353853040-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-08-17 17:04     ` Vivek Goyal

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.