Blame 0010-dmsquash-live-root-Avoid-mount-source-conflict-on-BA.patch

Harald Hoyer 3763a8
From ea765c0ee17178fe74c73873505f7c86f40f9ec7 Mon Sep 17 00:00:00 2001
Harald Hoyer 3763a8
From: Frederick Grose <fgrose@sugarlabs.org>
Harald Hoyer 3763a8
Date: Sat, 8 Apr 2017 21:01:19 -0400
Harald Hoyer 3763a8
Subject: [PATCH] dmsquash-live-root: Avoid mount source conflict on
Harald Hoyer 3763a8
 $BASE_LOOPDEV.
Harald Hoyer 3763a8
Harald Hoyer 3763a8
The newer mount utilities are more strict about directly shared
Harald Hoyer 3763a8
devices. For OverlayFS boots, which mount $BASE_LOOPDEV directly,
Harald Hoyer 3763a8
avoid a mount error by indirectly sharing the read-only base
Harald Hoyer 3763a8
filesystem through a second, over-attached $BASE_LOOPDEV for
Harald Hoyer 3763a8
the DM live-base target.
Harald Hoyer 3763a8
---
Harald Hoyer 3763a8
 modules.d/90dmsquash-live/dmsquash-live-root.sh | 7 ++++++-
Harald Hoyer 3763a8
 1 file changed, 6 insertions(+), 1 deletion(-)
Harald Hoyer 3763a8
Harald Hoyer 3763a8
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
Harald Hoyer 3763a8
index 264983f5..3a25465c 100755
Harald Hoyer 3763a8
--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
Harald Hoyer 3763a8
+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
Harald Hoyer 3763a8
@@ -241,7 +241,12 @@ do_live_overlay() {
Harald Hoyer 3763a8
     fi
Harald Hoyer 3763a8
 
Harald Hoyer 3763a8
     # Create a device that always points to a ro base image
Harald Hoyer 3763a8
-    echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base
Harald Hoyer 3763a8
+    if [ -n "$overlayfs" ]; then
Harald Hoyer 3763a8
+        BASE_LOOPDUP=$(losetup -f --show -r $BASE_LOOPDEV)
Harald Hoyer 3763a8
+        echo 0 $sz linear $BASE_LOOPDUP 0 | dmsetup create --readonly live-base
Harald Hoyer 3763a8
+    else
Harald Hoyer 3763a8
+        echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base
Harald Hoyer 3763a8
+    fi
Harald Hoyer 3763a8
 }
Harald Hoyer 3763a8
 
Harald Hoyer 3763a8
 # we might have a genMinInstDelta delta file for anaconda to take advantage of