]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
volatile-binds: Remove workdir if OverlayFS fails
authorRicardo Simoes <ricardo.simoes@pt.bosch.com>
Thu, 18 Jul 2024 06:46:34 +0000 (08:46 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 18 Jul 2024 16:21:01 +0000 (17:21 +0100)
To fulfill OverlayFS workdir requirements, the mount-copybind script
creates a workdir. But if the mount operation fails for any reason,
the workdir is left there.

Then, subsequent runs of mount-copybind will again try to
create the directory and pollute system logs with failed mkdir error
messages.

This commit mitigates the problem by unconditionally removing workdir
if the OverlayFS is not used or fails to run.

Signed-off-by: Ricardo Simoes <ricardo.simoes@pt.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/volatile-binds/files/mount-copybind

index da88d160ee0435e2e8ee5d40b50c0de926b9ba0d..4f373412be6f940c1fff817c31fe5199b4da3e44 100755 (executable)
@@ -57,6 +57,7 @@ if [ -d "$mountpoint" ]; then
         fi
     fi
     if [ "$MOUNT_COPYBIND_AVOID_OVERLAYFS" = 1 ] || ! mount -t overlay overlay -olowerdir="$mountpoint",upperdir="$spec",workdir="$overlay_workdir""$mountcontext" "$mountpoint" > /dev/null 2>&1; then
+        rm -rf "$overlay_workdir"
 
         if [ "$specdir_existed" != "yes" ]; then
             cp -aPR "$mountpoint"/. "$spec/"