diff --git a/patches/initrd/unionstackmount1310.patch b/patches/initrd/unionstackmount1310.patch index b9a4cc8784d6a417bfa79dcf95c7096c1d547057..8d2d5a6c610730c8d215db747612b6df74eb723c 100644 --- a/patches/initrd/unionstackmount1310.patch +++ b/patches/initrd/unionstackmount1310.patch @@ -9,7 +9,7 @@ ip=*) STATICIP=${x#ip=} if [ "${STATICIP}" = "" ]; then -@@ -426,6 +428,13 @@ +@@ -490,6 +492,13 @@ continue fi @@ -23,45 +23,43 @@ if [ -d "${image}" ]; then # it is a plain directory: do nothing rofsstring="${image}=${roopt}:${rofsstring}" -@@ -461,6 +470,10 @@ - fi - - mount -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} /cow || panic "Can not mount $cowdevice on /cow" -+ -+ overlay_mount_dir=/overlay -+ mkdir -p "$overlay_mount_dir" -+ - - case ${UNIONFS} in - unionfs-fuse) -@@ -475,7 +488,9 @@ - # Mount the layers pairwise from the bottom onto rootmnt, - # for the second and later layers rootmnt forms the lower layer. +@@ -519,26 +528,18 @@ + mount -t ${UNIONFS} -o noatime,dirs=/cow/upper=rw:$rofsstring ${UNIONFS} "$rootmnt" || panic "${UNIONFS} mount failed" + ;; + overlay|overlayfs) +- # Mount the layers pairwise from the bottom onto rootmnt, +- # for the second and later layers rootmnt forms the lower layer. mounts="" - for mount in /cow $rofslist -+ -+ #overlay all readonly file systems first + for mount in $rofslist do - mounts="$mount $mounts" - done -@@ -487,9 +502,13 @@ - continue - fi - mount -t overlayfs -o "upperdir=$mount,lowerdir=$lower" \ -- "$mount" "$rootmnt" +- mounts="$mount $mounts" +- done +- lower="" +- for mount in $mounts +- do +- if [ "$lower" = "" ]; then +- lower="$mount" +- continue +- fi +- mount -t ${UNIONFS} -o "upperdir=$mount/upper,lowerdir=$lower,workdir=$mount/work" \ +- "$mount" "$rootmnt" || \ +- mount -t ${UNIONFS} -o "upperdir=$mount/upper,lowerdir=$lower" \ +- "$mount" "$rootmnt" - lower="$rootmnt" -+ "$mount" "$overlay_mount_dir" -+ lower="$overlay_mount_dir" ++ mounts="${mount}:${mounts}" done -+ -+ mount -t overlayfs -o "upperdir=/cow,lowerdir=$lower" \ -+ "$mount" "$rootmnt" -+ ++ mounts="${mounts%:}" ++ overlay_mount_dir=/overlay ++ mkdir -p "${overlay_mount_dir}" ++ mount -t ${UNIONFS} -o "lowerdir=${mounts}" root "${overlay_mount_dir}" ++ # Stacking multiple overlays leads to "No such device" errors upon access ++ mount -t ${UNIONFS} -o "lowerdir=${overlay_mount_dir},upperdir=/cow/upper,workdir=/cow/work" cowroot "${rootmnt}" ++ lower="${overlay_mount_dir}" ;; esac -@@ -530,15 +549,17 @@ +@@ -579,15 +580,17 @@ fi # move the first mount; no head in busybox-initramfs