[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#573761: [PATCH] hook-functions: let dep_add_modules() recurse into lvm slave devices



When searching for the root block device, there may be multiple device
mapper indirections.

Signed-off-by: Nikolaus Schulz <microschulz@web.de>
---
 hook-functions |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hook-functions b/hook-functions
index 98597db..7e7c14c 100644
--- a/hook-functions
+++ b/hook-functions
@@ -284,10 +284,10 @@ dep_add_modules()
 		|| [ "${root#/dev/dm-}" != "${root}" ]; then
 		minor=$((0x$(stat --format "%T" ${root}) % 256))
 		block=$(ls -1 /sys/block/dm-${minor}/slaves | head -n 1)
-		# lvm on luks or luks on lvm
-		if [ "${block#dm-}" != "${block}" ]; then
+		# lvm on luks or luks on lvm, possibly lvm snapshots
+		while [ "${block#dm-}" != "${block}" ]; do
 			block=$(ls -1 /sys/block/${block}/slaves | head -n 1)
-		fi
+		done
 		# lvm on md or luks on md
 		if [ "${block#md}" != "${block}" ]; then
 			block=$(awk "/^${block}/{print substr(\$5, 1, 4); exit}" \
-- 
1.7.0



Reply to: