Blob Blame History Raw
From 4233fe30b315737ac8c4d857e2b04e021c2e2886 Mon Sep 17 00:00:00 2001
From: Pavel Cahyna <pcahyna@redhat.com>
Date: Mon, 16 Aug 2021 10:10:38 +0300
Subject: [PATCH] Revert the main part of PR #2299

multipath -l is very slow with many multipath devices. As it will be
called for every multipath device, it leads to quadratic time complexity
in the number of multipath devices. For thousands of devices, ReaR can
take hours to scan and exclude them. We therefore have to comment
multipath -l out, as it is a huge performance regression, and find
another solution to bug #2298.
---
 usr/share/rear/lib/layout-functions.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/usr/share/rear/lib/layout-functions.sh b/usr/share/rear/lib/layout-functions.sh
index cdd81a14..8c8be74b 100644
--- a/usr/share/rear/lib/layout-functions.sh
+++ b/usr/share/rear/lib/layout-functions.sh
@@ -771,7 +771,10 @@ function is_multipath_path {
     # so that no "multipath -l" output could clutter the log (the "multipath -l" output is irrelevant here)
     # in contrast to e.g. test "$( multipath -l )" that would falsely succeed with blank output
     # and the output would appear in the log in 'set -x' debugscript mode:
-    multipath -l | grep -q '[[:alnum:]]' || return 1
+    #
+    # Unfortunately, multipat -l is quite slow with many multipath devices
+    # and becomes a performance bottleneck, so we must comment it out for now.
+    #multipath -l | grep -q '[[:alnum:]]' || return 1
     # Check if a block device should be a path in a multipath device:
     multipath -c /dev/$1 &>/dev/null
 }
-- 
2.26.3