Allow lazy unmount of special bind-mounts
Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
parent
739fe9d9db
commit
2863b657e3
|
@ -17,7 +17,7 @@
|
|||
Summary: Tools for building live CDs
|
||||
Name: livecd-tools
|
||||
Version: 31.0
|
||||
Release: 3%{?dist}
|
||||
Release: 3.0.riscv64%{?dist}
|
||||
%if 0%{?fedora}
|
||||
Epoch: 1
|
||||
%endif
|
||||
|
@ -25,6 +25,8 @@ License: GPLv2
|
|||
URL: https://github.com/livecd-tools/livecd-tools
|
||||
Source0: https://releases.pagure.org/%{name}/%{name}-%{version}.tar.gz
|
||||
|
||||
Patch0: test-fix.patch
|
||||
|
||||
BuildRequires: make
|
||||
%if %{with python2}
|
||||
BuildRequires: python2-devel
|
||||
|
@ -63,6 +65,8 @@ Requires: dosfstools >= 2.11-8
|
|||
Requires: e2fsprogs
|
||||
Requires: lorax >= 18.3
|
||||
Requires: rsync
|
||||
Requires: lsof
|
||||
Requires: psmisc
|
||||
|
||||
%if ! 0%{?rhel}
|
||||
# hfs+ support for Macs
|
||||
|
@ -225,6 +229,10 @@ rm -rfv %{buildroot}%{_mandir}/man8/livecd-iso-to-*
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Apr 17 2023 David Abdurachmanov <davidlt@rivosinc.com> - 1:31.0-3.0.riscv64
|
||||
- Collect more information what is blocking mount point
|
||||
- Special bind-mounts can be lazy unmounted.
|
||||
|
||||
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:31.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
diff --git a/imgcreate/fs.py b/imgcreate/fs.py
|
||||
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(10)
|
||||
rc = call(['umount', self.mountdir])
|
||||
if rc != 0:
|
||||
+ logging.info("- - - lsof %s - - -" % self.mountdir)
|
||||
+ call(['lsof', '+c0', self.mountdir])
|
||||
+ logging.info("- - - lsof %s - - -" % self.mountdir)
|
||||
+ logging.info("- - - fuser %s - - -" % self.mountdir)
|
||||
+ call(['fuser', '-v', '-m', self.mountdir])
|
||||
+ logging.info("- - - fuser %s - - -" % self.mountdir)
|
||||
+ logging.info("- - - pstree - - -")
|
||||
+ call(['pstree', '-Talp'])
|
||||
+ logging.info("- - - pstree - - -")
|
||||
call(['umount', '-l', self.mountdir])
|
||||
raise MountError(umount_fail_fmt % self.mountdir)
|
||||
self.mounted = False
|
||||
@@ -981,8 +991,18 @@ class OverlayFSMount(Mount):
|
||||
if not self.mounted:
|
||||
return
|
||||
|
||||
+ time.sleep(10)
|
||||
rc = call(['umount', self.mountdir])
|
||||
if rc != 0:
|
||||
+ logging.info("- - - lsof %s - - -" % self.mountdir)
|
||||
+ call(['lsof', '+c0', self.mountdir])
|
||||
+ logging.info("- - - lsof %s - - -" % self.mountdir)
|
||||
+ logging.info("- - - fuser %s - - -" % self.mountdir)
|
||||
+ call(['fuser', '-v', '-m', self.mountdir])
|
||||
+ logging.info("- - - fuser %s - - -" % self.mountdir)
|
||||
+ logging.info("- - - pstree - - -")
|
||||
+ call(['pstree', '-Talp'])
|
||||
+ logging.info("- - - pstree - - -")
|
||||
call(['umount', '-l', self.mountdir])
|
||||
raise MountError(umount_fail_fmt % self.mountdir)
|
||||
if self.cowmnt:
|
||||
@@ -1059,10 +1079,21 @@ class BindChrootMount():
|
||||
self.mounted = False
|
||||
return
|
||||
|
||||
+ time.sleep(10)
|
||||
rc = call(['umount', self.dest])
|
||||
if rc != 0:
|
||||
+ logging.info("- - - lsof %s - - -" % self.dest)
|
||||
+ call(['lsof', '+c0', self.dest])
|
||||
+ logging.info("- - - lsof %s - - -" % self.dest)
|
||||
+ logging.info("- - - fuser %s - - -" % self.dest)
|
||||
+ call(['fuser', '-v', '-m', self.dest])
|
||||
+ logging.info("- - - fuser %s - - -" % self.dest)
|
||||
+ logging.info("- - - pstree - - -")
|
||||
+ call(['pstree', '-Talp'])
|
||||
+ logging.info("- - - pstree - - -")
|
||||
call(['umount', '-l', 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
|
||||
+++ b/imgcreate/util.py
|
||||
@@ -32,7 +32,7 @@ def call(*popenargs, **kwargs):
|
||||
stderr=subprocess.STDOUT, **kwargs)
|
||||
rc = p.wait()
|
||||
fp = io.open(p.stdout.fileno(), mode="r", encoding="utf-8", closefd=False)
|
||||
- stdout = fp.read().split()
|
||||
+ stdout = fp.read().splitlines()
|
||||
fp.close()
|
||||
|
||||
# Log output using logging module
|
Loading…
Reference in New Issue