public inbox for initramfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 90multipath: add hostonly multipath.conf in case hostonly mode
@ 2015-07-06  7:31 Dave Young
       [not found] ` <20150706073126.GC22559-0VdLhd/A9Pldm++G7ovJGB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Dave Young @ 2015-07-06  7:31 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA
  Cc: harald-H+wXaHxf7aLQT0dZR+AlfA, bmarzins-H+wXaHxf7aLQT0dZR+AlfA

For large machine, suppose there's a lot of multipath devices, multipath layer
will use a lot of memory. For kdump kernel memory is very limited thus it causes
oom. To avoid oom, we only add necessary multipath devices in kdump kernel
multipath.conf.

This is done by use mpathconf --allow, a new option which is like whitelist.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/90multipath/module-setup.sh | 42 ++++++++++++++++++++++++++++-------
 1 file changed, 34 insertions(+), 8 deletions(-)

diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index 29643d4..321f13e 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -1,18 +1,28 @@
 #!/bin/bash
 
+is_mpath() {
+    local _dev=$1
+    [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
+    [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
+    return 1
+}
+
+majmin_to_mpath_dev() {
+    local _dev
+    for i in `ls -1 /dev/mapper/mpath*`; do
+        dev=$(get_maj_min $i)
+        if [ "$dev" = "$1" ]; then
+            echo $i
+            return
+        fi
+    done
+}
 # called by dracut
 check() {
     local _rootdev
     # if there's no multipath binary, no go.
     require_binaries multipath || return 1
 
-    is_mpath() {
-        local _dev=$1
-        [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
-        [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
-        return 1
-    }
-
     [[ $hostonly ]] || [[ $mount_needs ]] && {
         for_each_host_dev_and_slaves is_mpath || return 255
     }
@@ -79,7 +89,18 @@ installkernel() {
 
 # called by dracut
 install() {
-    local _f
+    local _f _allow
+    add_hostonly_mpath_conf() {
+        is_mpath $1 && {
+            local _dev
+
+            _dev=$(majmin_to_mpath_dev $1)
+            [ -z "$_dev" ] && return
+            strstr "$_allow" "$_dev" && return
+            _allow="$_allow --allow $_dev"
+        }
+    }
+
     inst_multiple -o  \
         dmsetup \
         kpartx \
@@ -93,6 +114,11 @@ install() {
         /etc/multipath.conf \
         /etc/multipath/*
 
+    [[ $hostonly ]] && {
+        for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
+        [ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
+    }
+
     inst $(command -v partx) /sbin/partx
 
     inst_libdir_file "libmultipath*" "multipath/*"
-- 
1.8.3.1

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

* Re: [PATCH] 90multipath: add hostonly multipath.conf in case hostonly mode
       [not found] ` <20150706073126.GC22559-0VdLhd/A9Pldm++G7ovJGB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
@ 2015-07-06  8:06   ` Dracut GitHub Import Bot
  2015-07-06 10:03   ` Harald Hoyer
  1 sibling, 0 replies; 5+ messages in thread
From: Dracut GitHub Import Bot @ 2015-07-06  8:06 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

Patchset imported to github.
Pull request:
<https://github.com/haraldh/dracut/compare/master...dracut-mailing-devs:20150706073126.GC22559%40dhcp-128-51.nay.redhat.com>


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

* Re: [PATCH] 90multipath: add hostonly multipath.conf in case hostonly mode
       [not found] ` <20150706073126.GC22559-0VdLhd/A9Pldm++G7ovJGB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
  2015-07-06  8:06   ` Dracut GitHub Import Bot
@ 2015-07-06 10:03   ` Harald Hoyer
       [not found]     ` <559A5279.9010101-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Harald Hoyer @ 2015-07-06 10:03 UTC (permalink / raw)
  To: Dave Young, initramfs-u79uwXL29TY76Z2rM5mHXA
  Cc: bmarzins-H+wXaHxf7aLQT0dZR+AlfA

On 06.07.2015 09:31, Dave Young wrote:
> For large machine, suppose there's a lot of multipath devices, multipath layer
> will use a lot of memory. For kdump kernel memory is very limited thus it causes
> oom. To avoid oom, we only add necessary multipath devices in kdump kernel
> multipath.conf.
> 
> This is done by use mpathconf --allow, a new option which is like whitelist.
> 
> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  modules.d/90multipath/module-setup.sh | 42 ++++++++++++++++++++++++++++-------
>  1 file changed, 34 insertions(+), 8 deletions(-)
> 
> diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
> index 29643d4..321f13e 100755
> --- a/modules.d/90multipath/module-setup.sh
> +++ b/modules.d/90multipath/module-setup.sh
> @@ -1,18 +1,28 @@
>  #!/bin/bash
>  
> +is_mpath() {
> +    local _dev=$1
> +    [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
> +    [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
> +    return 1
> +}
> +
> +majmin_to_mpath_dev() {
> +    local _dev
> +    for i in `ls -1 /dev/mapper/mpath*`; do
> +        dev=$(get_maj_min $i)
> +        if [ "$dev" = "$1" ]; then
> +            echo $i
> +            return
> +        fi
> +    done
> +}
>  # called by dracut
>  check() {
>      local _rootdev
>      # if there's no multipath binary, no go.
>      require_binaries multipath || return 1
>  
> -    is_mpath() {
> -        local _dev=$1
> -        [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
> -        [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
> -        return 1
> -    }
> -
>      [[ $hostonly ]] || [[ $mount_needs ]] && {
>          for_each_host_dev_and_slaves is_mpath || return 255
>      }
> @@ -79,7 +89,18 @@ installkernel() {
>  
>  # called by dracut
>  install() {
> -    local _f
> +    local _f _allow
> +    add_hostonly_mpath_conf() {
> +        is_mpath $1 && {
> +            local _dev
> +
> +            _dev=$(majmin_to_mpath_dev $1)
> +            [ -z "$_dev" ] && return
> +            strstr "$_allow" "$_dev" && return
> +            _allow="$_allow --allow $_dev"
> +        }
> +    }
> +
>      inst_multiple -o  \
>          dmsetup \
>          kpartx \
> @@ -93,6 +114,11 @@ install() {
>          /etc/multipath.conf \
>          /etc/multipath/*
>  
> +    [[ $hostonly ]] && {
> +        for_each_host_dev_and_slaves_all add_hostonly_mpath_conf

don't we have to just check all $host_devs if it is a /dev/mapper/mpath* ??

> +        [ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
> +    }
> +
>      inst $(command -v partx) /sbin/partx
>  
>      inst_libdir_file "libmultipath*" "multipath/*"
> 

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

* Re: [PATCH] 90multipath: add hostonly multipath.conf in case hostonly mode
       [not found]     ` <559A5279.9010101-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-07-07  1:52       ` Dave Young
       [not found]         ` <20150707015252.GA8343-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Dave Young @ 2015-07-07  1:52 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, bmarzins-H+wXaHxf7aLQT0dZR+AlfA

On 07/06/15 at 12:03pm, Harald Hoyer wrote:
> On 06.07.2015 09:31, Dave Young wrote:
> > For large machine, suppose there's a lot of multipath devices, multipath layer
> > will use a lot of memory. For kdump kernel memory is very limited thus it causes
> > oom. To avoid oom, we only add necessary multipath devices in kdump kernel
> > multipath.conf.
> > 
> > This is done by use mpathconf --allow, a new option which is like whitelist.
> > 
> > Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > ---
> >  modules.d/90multipath/module-setup.sh | 42 ++++++++++++++++++++++++++++-------
> >  1 file changed, 34 insertions(+), 8 deletions(-)
> > 
> > diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
> > index 29643d4..321f13e 100755
> > --- a/modules.d/90multipath/module-setup.sh
> > +++ b/modules.d/90multipath/module-setup.sh
> > @@ -1,18 +1,28 @@
> >  #!/bin/bash
> >  
> > +is_mpath() {
> > +    local _dev=$1
> > +    [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
> > +    [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
> > +    return 1
> > +}
> > +
> > +majmin_to_mpath_dev() {
> > +    local _dev
> > +    for i in `ls -1 /dev/mapper/mpath*`; do
> > +        dev=$(get_maj_min $i)
> > +        if [ "$dev" = "$1" ]; then
> > +            echo $i
> > +            return
> > +        fi
> > +    done
> > +}
> >  # called by dracut
> >  check() {
> >      local _rootdev
> >      # if there's no multipath binary, no go.
> >      require_binaries multipath || return 1
> >  
> > -    is_mpath() {
> > -        local _dev=$1
> > -        [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
> > -        [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
> > -        return 1
> > -    }
> > -
> >      [[ $hostonly ]] || [[ $mount_needs ]] && {
> >          for_each_host_dev_and_slaves is_mpath || return 255
> >      }
> > @@ -79,7 +89,18 @@ installkernel() {
> >  
> >  # called by dracut
> >  install() {
> > -    local _f
> > +    local _f _allow
> > +    add_hostonly_mpath_conf() {
> > +        is_mpath $1 && {
> > +            local _dev
> > +
> > +            _dev=$(majmin_to_mpath_dev $1)
> > +            [ -z "$_dev" ] && return
> > +            strstr "$_allow" "$_dev" && return
> > +            _allow="$_allow --allow $_dev"
> > +        }
> > +    }
> > +
> >      inst_multiple -o  \
> >          dmsetup \
> >          kpartx \
> > @@ -93,6 +114,11 @@ install() {
> >          /etc/multipath.conf \
> >          /etc/multipath/*
> >  
> > +    [[ $hostonly ]] && {
> > +        for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
> 
> don't we have to just check all $host_devs if it is a /dev/mapper/mpath* ??

Harald, I worry about stacked devices, host_devs are the top level devices,
if slave deivces are multipath we should use for_each_host_dev_and_slaves,
right?

> 
> > +        [ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
> > +    }
> > +
> >      inst $(command -v partx) /sbin/partx
> >  
> >      inst_libdir_file "libmultipath*" "multipath/*"
> > 
> 

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

* Re: [PATCH] 90multipath: add hostonly multipath.conf in case hostonly mode
       [not found]         ` <20150707015252.GA8343-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2015-07-07 11:01           ` Harald Hoyer
  0 siblings, 0 replies; 5+ messages in thread
From: Harald Hoyer @ 2015-07-07 11:01 UTC (permalink / raw)
  To: Dave Young
  Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, bmarzins-H+wXaHxf7aLQT0dZR+AlfA

On 07.07.2015 03:52, Dave Young wrote:
> On 07/06/15 at 12:03pm, Harald Hoyer wrote:
>> On 06.07.2015 09:31, Dave Young wrote:
>>> For large machine, suppose there's a lot of multipath devices, multipath layer
>>> will use a lot of memory. For kdump kernel memory is very limited thus it causes
>>> oom. To avoid oom, we only add necessary multipath devices in kdump kernel
>>> multipath.conf.
>>>
>>> This is done by use mpathconf --allow, a new option which is like whitelist.
>>>
>>> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>> ---
>>>  modules.d/90multipath/module-setup.sh | 42 ++++++++++++++++++++++++++++-------
>>>  1 file changed, 34 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
>>> index 29643d4..321f13e 100755
>>> --- a/modules.d/90multipath/module-setup.sh
>>> +++ b/modules.d/90multipath/module-setup.sh
>>> @@ -1,18 +1,28 @@
>>>  #!/bin/bash
>>>  
>>> +is_mpath() {
>>> +    local _dev=$1
>>> +    [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
>>> +    [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
>>> +    return 1
>>> +}
>>> +
>>> +majmin_to_mpath_dev() {
>>> +    local _dev
>>> +    for i in `ls -1 /dev/mapper/mpath*`; do
>>> +        dev=$(get_maj_min $i)
>>> +        if [ "$dev" = "$1" ]; then
>>> +            echo $i
>>> +            return
>>> +        fi
>>> +    done
>>> +}
>>>  # called by dracut
>>>  check() {
>>>      local _rootdev
>>>      # if there's no multipath binary, no go.
>>>      require_binaries multipath || return 1
>>>  
>>> -    is_mpath() {
>>> -        local _dev=$1
>>> -        [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
>>> -        [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
>>> -        return 1
>>> -    }
>>> -
>>>      [[ $hostonly ]] || [[ $mount_needs ]] && {
>>>          for_each_host_dev_and_slaves is_mpath || return 255
>>>      }
>>> @@ -79,7 +89,18 @@ installkernel() {
>>>  
>>>  # called by dracut
>>>  install() {
>>> -    local _f
>>> +    local _f _allow
>>> +    add_hostonly_mpath_conf() {
>>> +        is_mpath $1 && {
>>> +            local _dev
>>> +
>>> +            _dev=$(majmin_to_mpath_dev $1)
>>> +            [ -z "$_dev" ] && return
>>> +            strstr "$_allow" "$_dev" && return
>>> +            _allow="$_allow --allow $_dev"
>>> +        }
>>> +    }
>>> +
>>>      inst_multiple -o  \
>>>          dmsetup \
>>>          kpartx \
>>> @@ -93,6 +114,11 @@ install() {
>>>          /etc/multipath.conf \
>>>          /etc/multipath/*
>>>  
>>> +    [[ $hostonly ]] && {
>>> +        for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
>>
>> don't we have to just check all $host_devs if it is a /dev/mapper/mpath* ??
> 
> Harald, I worry about stacked devices, host_devs are the top level devices,
> if slave deivces are multipath we should use for_each_host_dev_and_slaves,
> right?

sorry, brain failure... too hot in here. You are right, of course.

> 
>>
>>> +        [ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
>>> +    }
>>> +
>>>      inst $(command -v partx) /sbin/partx
>>>  
>>>      inst_libdir_file "libmultipath*" "multipath/*"
>>>
>>

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

end of thread, other threads:[~2015-07-07 11:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-06  7:31 [PATCH] 90multipath: add hostonly multipath.conf in case hostonly mode Dave Young
     [not found] ` <20150706073126.GC22559-0VdLhd/A9Pldm++G7ovJGB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2015-07-06  8:06   ` Dracut GitHub Import Bot
2015-07-06 10:03   ` Harald Hoyer
     [not found]     ` <559A5279.9010101-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-07-07  1:52       ` Dave Young
     [not found]         ` <20150707015252.GA8343-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2015-07-07 11:01           ` Harald Hoyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox