Special bind-mounts can be lazy unmounted

Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
David Abdurachmanov 2022-11-19 22:11:24 +02:00
parent e76504900b
commit 3a6eb5e914
Signed by: davidlt
GPG Key ID: 8B7F1DA0E2C9FDBB
2 changed files with 15 additions and 7 deletions

View File

@ -17,7 +17,7 @@
Summary: Tools for building live CDs
Name: livecd-tools
Version: 31.0
Release: 2.1.riscv64%{?dist}
Release: 2.2.riscv64%{?dist}
%if 0%{?fedora}
Epoch: 1
%endif
@ -229,6 +229,10 @@ rm -rfv %{buildroot}%{_mandir}/man8/livecd-iso-to-*
%endif
%changelog
* Sat Nov 19 2022 David Abdurachmanov <davidlt@rivosinc.com> - 1:31.0-2.2.riscv64
- Lower wait to 10.
- Specia bind-mounts can be lazy unmounted.
* Sat Nov 19 2022 David Abdurachmanov <davidlt@rivosinc.com> - 1:31.0-2.1.riscv64
- Wait 600 seconds before calling umount
- Dump pstree output with pids

View File

@ -1,12 +1,12 @@
diff --git a/imgcreate/fs.py b/imgcreate/fs.py
index f999d05..83a8928 100644
index f999d05..5c5a003 100644
--- a/imgcreate/fs.py
+++ b/imgcreate/fs.py
@@ -820,8 +820,18 @@ class DiskMount(Mount):
def unmount(self):
if self.mounted:
logging.info("Unmounting directory %s" % self.mountdir)
+ time.sleep(600)
+ time.sleep(10)
rc = call(['umount', self.mountdir])
if rc != 0:
+ logging.info("- - - lsof %s - - -" % self.mountdir)
@ -25,7 +25,7 @@ index f999d05..83a8928 100644
if not self.mounted:
return
+ time.sleep(600)
+ time.sleep(10)
rc = call(['umount', self.mountdir])
if rc != 0:
+ logging.info("- - - lsof %s - - -" % self.mountdir)
@ -40,11 +40,11 @@ index f999d05..83a8928 100644
call(['umount', '-l', self.mountdir])
raise MountError(umount_fail_fmt % self.mountdir)
if self.cowmnt:
@@ -1059,8 +1079,18 @@ class BindChrootMount():
@@ -1059,10 +1079,21 @@ class BindChrootMount():
self.mounted = False
return
+ time.sleep(600)
+ time.sleep(10)
rc = call(['umount', self.dest])
if rc != 0:
+ logging.info("- - - lsof %s - - -" % self.dest)
@ -57,8 +57,12 @@ index f999d05..83a8928 100644
+ call(['pstree', '-Talp'])
+ logging.info("- - - pstree - - -")
call(['umount', '-l', self.dest])
raise MountError(umount_fail_fmt % self.dest)
- raise MountError(umount_fail_fmt % self.dest)
+ if self.src.strip() not in ('/sys', '/proc', '/dev/pts'):
+ raise MountError(umount_fail_fmt % self.dest)
self.mounted = False
def cleanup(self):
diff --git a/imgcreate/util.py b/imgcreate/util.py
index fad6772..04380c9 100644
--- a/imgcreate/util.py