Blob Blame History Raw
From dc316701f752f5197a6a926a9a401688ffdb9bca Mon Sep 17 00:00:00 2001
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Date: Thu, 26 Nov 2020 13:04:44 +0100
Subject: [PATCH] fix(mdraid): remove offroot

offroot is deprecated and can be safety removed.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
(cherry picked from commit 30e49d51751c695be85782cfc162de2a63db471c)

Resolves: #1958899
---
 modules.d/90mdraid/65-md-incremental-imsm.rules |  2 +-
 modules.d/90mdraid/md-shutdown.sh               |  5 ++---
 modules.d/90mdraid/mdraid-cleanup.sh            |  7 +++----
 modules.d/90mdraid/mdraid-waitclean.sh          |  7 +++----
 modules.d/90mdraid/mdraid_start.sh              | 10 +++-------
 modules.d/90mdraid/parse-md.sh                  |  2 --
 6 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
index 52f5b195..6697f159 100644
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
@@ -39,6 +39,6 @@ RUN+="/sbin/initqueue --timeout --name 50-mdraid_start --onetime --unique /sbin/
 #
 LABEL="md_incremental"
 
-RUN+="/sbin/mdadm $env{rd_MD_OFFROOT} -I $env{DEVNAME}"
+RUN+="/sbin/mdadm -I $env{DEVNAME}"
 
 LABEL="md_end"
diff --git a/modules.d/90mdraid/md-shutdown.sh b/modules.d/90mdraid/md-shutdown.sh
index 400bb003..40c82570 100755
--- a/modules.d/90mdraid/md-shutdown.sh
+++ b/modules.d/90mdraid/md-shutdown.sh
@@ -3,12 +3,11 @@
 _do_md_shutdown() {
     local ret
     local final=$1
-    local _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
     info "Waiting for mdraid devices to be clean."
-    mdadm $_offroot -vv --wait-clean --scan| vinfo
+    mdadm -vv --wait-clean --scan| vinfo
     ret=$?
     info "Disassembling mdraid devices."
-    mdadm $_offroot -vv --stop --scan | vinfo
+    mdadm -vv --stop --scan | vinfo
     ret=$(($ret+$?))
     if [ "x$final" != "x" ]; then
         info "/proc/mdstat:"
diff --git a/modules.d/90mdraid/mdraid-cleanup.sh b/modules.d/90mdraid/mdraid-cleanup.sh
index 565449a5..007e581b 100755
--- a/modules.d/90mdraid/mdraid-cleanup.sh
+++ b/modules.d/90mdraid/mdraid-cleanup.sh
@@ -2,7 +2,6 @@
 
 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
 
-_offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
 containers=""
 for md in /dev/md[0-9_]*; do
     [ -b "$md" ] || continue
@@ -12,11 +11,11 @@ for md in /dev/md[0-9_]*; do
         containers="$containers $md"
         continue
     fi
-    mdadm $_offroot -S "$md" >/dev/null 2>&1
+    mdadm -S "$md" >/dev/null 2>&1
 done
 
 for md in $containers; do
-    mdadm $_offroot -S "$md" >/dev/null 2>&1
+    mdadm -S "$md" >/dev/null 2>&1
 done
 
-unset containers udevinfo _offroot
+unset containers udevinfo
diff --git a/modules.d/90mdraid/mdraid-waitclean.sh b/modules.d/90mdraid/mdraid-waitclean.sh
index 5c901982..0a7480f7 100755
--- a/modules.d/90mdraid/mdraid-waitclean.sh
+++ b/modules.d/90mdraid/mdraid-waitclean.sh
@@ -1,7 +1,6 @@
 #!/bin/sh
 
 if getargbool 0 rd.md.waitclean; then
-    _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
     containers=""
     for md in /dev/md[0-9_]*; do
@@ -13,13 +12,13 @@ if getargbool 0 rd.md.waitclean; then
             continue
         fi
         info "Waiting for $md to become clean"
-        mdadm $_offroot -W "$md" >/dev/null 2>&1
+        mdadm -W "$md" >/dev/null 2>&1
     done
 
     for md in $containers; do
         info "Waiting for $md to become clean"
-        mdadm $_offroot -W "$md" >/dev/null 2>&1
+        mdadm -W "$md" >/dev/null 2>&1
     done
 
-    unset containers udevinfo _offroot
+    unset containers udevinfo
 fi
diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh
index 77e843d7..ed8d8dfe 100755
--- a/modules.d/90mdraid/mdraid_start.sh
+++ b/modules.d/90mdraid/mdraid_start.sh
@@ -7,7 +7,6 @@ _md_start() {
     local _path_s
     local _path_d
     local _md="$1"
-    local _offroot="$2"
 
     _udevinfo="$(udevadm info --query=env --name="${_md}")"
     strstr "$_udevinfo" "MD_LEVEL=container" && continue
@@ -19,7 +18,7 @@ _md_start() {
     # inactive ?
     [ "$(cat "$_path_s")" != "inactive" ] && continue
 
-    mdadm $_offroot -R "${_md}" 2>&1 | vinfo
+    mdadm -R "${_md}" 2>&1 | vinfo
 
     # still inactive ?
     [ "$(cat "$_path_s")" = "inactive" ] && continue
@@ -30,14 +29,11 @@ _md_start() {
 }
 
 _md_force_run() {
-    local _offroot
     local _md
     local _UUID
     local _MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
     [ -n "$_MD_UUID" ] || getargbool 0 rd.auto || return
 
-    _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
-
     if [ -n "$_MD_UUID" ]; then
         _MD_UUID=$(str_replace "$_MD_UUID" "-" "")
         _MD_UUID=$(str_replace "$_MD_UUID" ":" "")
@@ -58,13 +54,13 @@ _md_force_run() {
             # check if we should handle this device
             strstr " $_MD_UUID " " $_UUID " || continue
 
-            _md_start "${_md}" "${_offroot}"
+            _md_start "${_md}"
         done
     else
         # try to force-run anything not running yet
         for _md in /dev/md[0-9_]*; do
             [ -b "$_md" ] || continue
-            _md_start "${_md}" "${_offroot}"
+            _md_start "${_md}"
         done
     fi
 }
diff --git a/modules.d/90mdraid/parse-md.sh b/modules.d/90mdraid/parse-md.sh
index 4d9baa52..2cce9769 100755
--- a/modules.d/90mdraid/parse-md.sh
+++ b/modules.d/90mdraid/parse-md.sh
@@ -60,5 +60,3 @@ if ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd -n nodmraid; then
     info "no MD RAID for SNIA ddf raids"
     udevproperty rd_NO_MDDDF=1
 fi
-
-strstr "$(mdadm --help-options 2>&1)" offroot && udevproperty rd_MD_OFFROOT=--offroot