ab92d3
From dc316701f752f5197a6a926a9a401688ffdb9bca Mon Sep 17 00:00:00 2001
ab92d3
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
ab92d3
Date: Thu, 26 Nov 2020 13:04:44 +0100
ab92d3
Subject: [PATCH] fix(mdraid): remove offroot
ab92d3
ab92d3
offroot is deprecated and can be safety removed.
ab92d3
ab92d3
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
ab92d3
(cherry picked from commit 30e49d51751c695be85782cfc162de2a63db471c)
ab92d3
ab92d3
Resolves: #1958899
ab92d3
---
ab92d3
 modules.d/90mdraid/65-md-incremental-imsm.rules |  2 +-
ab92d3
 modules.d/90mdraid/md-shutdown.sh               |  5 ++---
ab92d3
 modules.d/90mdraid/mdraid-cleanup.sh            |  7 +++----
ab92d3
 modules.d/90mdraid/mdraid-waitclean.sh          |  7 +++----
ab92d3
 modules.d/90mdraid/mdraid_start.sh              | 10 +++-------
ab92d3
 modules.d/90mdraid/parse-md.sh                  |  2 --
ab92d3
 6 files changed, 12 insertions(+), 21 deletions(-)
ab92d3
ab92d3
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
ab92d3
index 52f5b195..6697f159 100644
ab92d3
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
ab92d3
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
ab92d3
@@ -39,6 +39,6 @@ RUN+="/sbin/initqueue --timeout --name 50-mdraid_start --onetime --unique /sbin/
ab92d3
 #
ab92d3
 LABEL="md_incremental"
ab92d3
 
ab92d3
-RUN+="/sbin/mdadm $env{rd_MD_OFFROOT} -I $env{DEVNAME}"
ab92d3
+RUN+="/sbin/mdadm -I $env{DEVNAME}"
ab92d3
 
ab92d3
 LABEL="md_end"
ab92d3
diff --git a/modules.d/90mdraid/md-shutdown.sh b/modules.d/90mdraid/md-shutdown.sh
ab92d3
index 400bb003..40c82570 100755
ab92d3
--- a/modules.d/90mdraid/md-shutdown.sh
ab92d3
+++ b/modules.d/90mdraid/md-shutdown.sh
ab92d3
@@ -3,12 +3,11 @@
ab92d3
 _do_md_shutdown() {
ab92d3
     local ret
ab92d3
     local final=$1
ab92d3
-    local _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
ab92d3
     info "Waiting for mdraid devices to be clean."
ab92d3
-    mdadm $_offroot -vv --wait-clean --scan| vinfo
ab92d3
+    mdadm -vv --wait-clean --scan| vinfo
ab92d3
     ret=$?
ab92d3
     info "Disassembling mdraid devices."
ab92d3
-    mdadm $_offroot -vv --stop --scan | vinfo
ab92d3
+    mdadm -vv --stop --scan | vinfo
ab92d3
     ret=$(($ret+$?))
ab92d3
     if [ "x$final" != "x" ]; then
ab92d3
         info "/proc/mdstat:"
ab92d3
diff --git a/modules.d/90mdraid/mdraid-cleanup.sh b/modules.d/90mdraid/mdraid-cleanup.sh
ab92d3
index 565449a5..007e581b 100755
ab92d3
--- a/modules.d/90mdraid/mdraid-cleanup.sh
ab92d3
+++ b/modules.d/90mdraid/mdraid-cleanup.sh
ab92d3
@@ -2,7 +2,6 @@
ab92d3
 
ab92d3
 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
ab92d3
 
ab92d3
-_offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
ab92d3
 containers=""
ab92d3
 for md in /dev/md[0-9_]*; do
ab92d3
     [ -b "$md" ] || continue
ab92d3
@@ -12,11 +11,11 @@ for md in /dev/md[0-9_]*; do
ab92d3
         containers="$containers $md"
ab92d3
         continue
ab92d3
     fi
ab92d3
-    mdadm $_offroot -S "$md" >/dev/null 2>&1
ab92d3
+    mdadm -S "$md" >/dev/null 2>&1
ab92d3
 done
ab92d3
 
ab92d3
 for md in $containers; do
ab92d3
-    mdadm $_offroot -S "$md" >/dev/null 2>&1
ab92d3
+    mdadm -S "$md" >/dev/null 2>&1
ab92d3
 done
ab92d3
 
ab92d3
-unset containers udevinfo _offroot
ab92d3
+unset containers udevinfo
ab92d3
diff --git a/modules.d/90mdraid/mdraid-waitclean.sh b/modules.d/90mdraid/mdraid-waitclean.sh
ab92d3
index 5c901982..0a7480f7 100755
ab92d3
--- a/modules.d/90mdraid/mdraid-waitclean.sh
ab92d3
+++ b/modules.d/90mdraid/mdraid-waitclean.sh
ab92d3
@@ -1,7 +1,6 @@
ab92d3
 #!/bin/sh
ab92d3
 
ab92d3
 if getargbool 0 rd.md.waitclean; then
ab92d3
-    _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
ab92d3
     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
ab92d3
     containers=""
ab92d3
     for md in /dev/md[0-9_]*; do
ab92d3
@@ -13,13 +12,13 @@ if getargbool 0 rd.md.waitclean; then
ab92d3
             continue
ab92d3
         fi
ab92d3
         info "Waiting for $md to become clean"
ab92d3
-        mdadm $_offroot -W "$md" >/dev/null 2>&1
ab92d3
+        mdadm -W "$md" >/dev/null 2>&1
ab92d3
     done
ab92d3
 
ab92d3
     for md in $containers; do
ab92d3
         info "Waiting for $md to become clean"
ab92d3
-        mdadm $_offroot -W "$md" >/dev/null 2>&1
ab92d3
+        mdadm -W "$md" >/dev/null 2>&1
ab92d3
     done
ab92d3
 
ab92d3
-    unset containers udevinfo _offroot
ab92d3
+    unset containers udevinfo
ab92d3
 fi
ab92d3
diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh
ab92d3
index 77e843d7..ed8d8dfe 100755
ab92d3
--- a/modules.d/90mdraid/mdraid_start.sh
ab92d3
+++ b/modules.d/90mdraid/mdraid_start.sh
ab92d3
@@ -7,7 +7,6 @@ _md_start() {
ab92d3
     local _path_s
ab92d3
     local _path_d
ab92d3
     local _md="$1"
ab92d3
-    local _offroot="$2"
ab92d3
 
ab92d3
     _udevinfo="$(udevadm info --query=env --name="${_md}")"
ab92d3
     strstr "$_udevinfo" "MD_LEVEL=container" && continue
ab92d3
@@ -19,7 +18,7 @@ _md_start() {
ab92d3
     # inactive ?
ab92d3
     [ "$(cat "$_path_s")" != "inactive" ] && continue
ab92d3
 
ab92d3
-    mdadm $_offroot -R "${_md}" 2>&1 | vinfo
ab92d3
+    mdadm -R "${_md}" 2>&1 | vinfo
ab92d3
 
ab92d3
     # still inactive ?
ab92d3
     [ "$(cat "$_path_s")" = "inactive" ] && continue
ab92d3
@@ -30,14 +29,11 @@ _md_start() {
ab92d3
 }
ab92d3
 
ab92d3
 _md_force_run() {
ab92d3
-    local _offroot
ab92d3
     local _md
ab92d3
     local _UUID
ab92d3
     local _MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
ab92d3
     [ -n "$_MD_UUID" ] || getargbool 0 rd.auto || return
ab92d3
 
ab92d3
-    _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
ab92d3
-
ab92d3
     if [ -n "$_MD_UUID" ]; then
ab92d3
         _MD_UUID=$(str_replace "$_MD_UUID" "-" "")
ab92d3
         _MD_UUID=$(str_replace "$_MD_UUID" ":" "")
ab92d3
@@ -58,13 +54,13 @@ _md_force_run() {
ab92d3
             # check if we should handle this device
ab92d3
             strstr " $_MD_UUID " " $_UUID " || continue
ab92d3
 
ab92d3
-            _md_start "${_md}" "${_offroot}"
ab92d3
+            _md_start "${_md}"
ab92d3
         done
ab92d3
     else
ab92d3
         # try to force-run anything not running yet
ab92d3
         for _md in /dev/md[0-9_]*; do
ab92d3
             [ -b "$_md" ] || continue
ab92d3
-            _md_start "${_md}" "${_offroot}"
ab92d3
+            _md_start "${_md}"
ab92d3
         done
ab92d3
     fi
ab92d3
 }
ab92d3
diff --git a/modules.d/90mdraid/parse-md.sh b/modules.d/90mdraid/parse-md.sh
ab92d3
index 4d9baa52..2cce9769 100755
ab92d3
--- a/modules.d/90mdraid/parse-md.sh
ab92d3
+++ b/modules.d/90mdraid/parse-md.sh
ab92d3
@@ -60,5 +60,3 @@ if ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd -n nodmraid; then
ab92d3
     info "no MD RAID for SNIA ddf raids"
ab92d3
     udevproperty rd_NO_MDDDF=1
ab92d3
 fi
ab92d3
-
ab92d3
-strstr "$(mdadm --help-options 2>&1)" offroot && udevproperty rd_MD_OFFROOT=--offroot
ab92d3