Blob Blame History Raw
From a283636b83da0ea967bb0281a8f730750f6a2702 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 18 Aug 2015 15:04:31 +0200
Subject: [PATCH] dmraid: only scan once because of one device

(cherry picked from commit 80153acc0f8bbb3829575201e2a0ba3da41268a8)
---
 modules.d/90dmraid/61-dmraid-imsm.rules | 2 +-
 modules.d/90dmraid/dmraid.sh            | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules.d/90dmraid/61-dmraid-imsm.rules b/modules.d/90dmraid/61-dmraid-imsm.rules
index 33e060b..de7e97e 100644
--- a/modules.d/90dmraid/61-dmraid-imsm.rules
+++ b/modules.d/90dmraid/61-dmraid-imsm.rules
@@ -24,6 +24,6 @@ PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] &&
 ENV{DEVTYPE}!="partition", \
     RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
 
-RUN+="/sbin/initqueue --onetime --unique --settled /sbin/dmraid_scan"
+RUN+="/sbin/initqueue --onetime --unique --settled /sbin/dmraid_scan $env{DEVNAME}"
 
 LABEL="dm_end"
diff --git a/modules.d/90dmraid/dmraid.sh b/modules.d/90dmraid/dmraid.sh
index 3dcff38..e7a09b0 100755
--- a/modules.d/90dmraid/dmraid.sh
+++ b/modules.d/90dmraid/dmraid.sh
@@ -2,6 +2,13 @@
 
 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
 
+dev="$1"
+devenc=$(str_replace "$1" '/' '\2f')
+
+[ -e /tmp/dmraid.$devenc ] && exit 0
+
+>/tmp/dmraid.$devenc
+
 DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)
 
 if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then