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

Bug#969886: os-prober: Skip partitions of RADOS block devices mapped by the Linux driver



Package: os-prober
Version: 1.77
Tags: patch

os-prober mounts and runs tests on partitions of RADOS block devices
mapped by the Linux driver.

While the grub-mount mechanism can be expected to be non-destructive
this is unnecessary dangerous and time consuming as GRUB has no support
for RBD.

# rbd showmapped
id pool image                                          snap device    
0  rbd  00000000-0000-0000-0000-000000000000.rbd.disk0 -    /dev/rbd0

os-prober: debug: running /usr/lib/os-probes/50mounted-tests on /dev/rbd0p1
os-prober: debug: running /usr/lib/os-probes/50mounted-tests on /dev/rbd0p2
os-prober: debug: os detected by /usr/lib/os-probes/50mounted-tests

After applying the patch:
os-prober: debug: /dev/rbd0p1: is a mapped rbd, skipping
os-prober: debug: /dev/rbd0p2: is a mapped rbd, skipping
--- os-prober	2018-08-10 21:23:18.000000000 +0200
+++ os-prober	2020-09-08 12:14:19.734764375 +0200
@@ -130,6 +130,10 @@
 if [ -f /proc/mdstat ] ; then
 	grep "^md" /proc/mdstat | parse_proc_mdstat >"$OS_PROBER_TMP/raided-map" || true
 fi
+: >"$OS_PROBER_TMP/rbd-map"
+if [ -d /dev/rbd/rbd ] ; then
+	readlink -f /dev/rbd/rbd/* >"$OS_PROBER_TMP/rbd-map" || true
+fi
 
 for partition in $(partitions); do
 	if ! mapped="$(mapdevfs "$partition")"; then
@@ -149,6 +153,12 @@
 		continue
 	fi
 
+        # Skip partitions of RADOS block devices mapped by the Linux driver
+	if grep -q "^$mapped" "$OS_PROBER_TMP/rbd-map" ; then
+		debug "$partition: is a mapped rbd, skipping"
+		continue
+	fi
+
 	if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map" ; then
 		for test in /usr/lib/os-probes/*; do
 			if [ -f "$test" ] && [ -x "$test" ]; then

Reply to: