From 3ace4046974b438665e8b0469b87648460ca07d6 Mon Sep 17 00:00:00 2001 From: Zsolt Ero Date: Thu, 9 Oct 2025 23:46:25 +0200 Subject: [PATCH] work --- modules/http_host/http_host_lib/mount.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/http_host/http_host_lib/mount.py b/modules/http_host/http_host_lib/mount.py index 3aa7f19..a3ebbe7 100644 --- a/modules/http_host/http_host_lib/mount.py +++ b/modules/http_host/http_host_lib/mount.py @@ -71,7 +71,12 @@ def clean_up_mounts(mnt_dir): mnt_path = Path(l.split('(deleted) on ')[1].split(' type btrfs')[0]) print(f' removing deleted mount {mnt_path}') assert mnt_path.exists() - subprocess.run(['umount', mnt_path], check=True) + + # Unmount ALL instances (handle stacked mounts) + while subprocess.run(['mountpoint', '-q', mnt_path]).returncode == 0: + print(f' unmounting {mnt_path}') + subprocess.run(['umount', mnt_path], check=True) + mnt_path.rmdir() # clean all mounts not in current fstab @@ -83,5 +88,10 @@ def clean_up_mounts(mnt_dir): continue print(f' removing old mount {subdir}') - subprocess.run(['umount', subdir], check=True) + + # Unmount ALL instances here too + while subprocess.run(['mountpoint', '-q', subdir]).returncode == 0: + print(f' unmounting {subdir}') + subprocess.run(['umount', subdir], check=True) + subdir.rmdir()