From 18cf4e0842280878185e509602a248c1bdce4022 Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Fri, 22 Mar 2024 16:14:50 +0200 Subject: [PATCH] Allow lazy unmount of special bind-mounts Signed-off-by: David Abdurachmanov --- livecd-tools.spec | 11 ++++++- test-fix.patch | 78 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 test-fix.patch diff --git a/livecd-tools.spec b/livecd-tools.spec index 3f95e94..ca7e7b0 100644 --- a/livecd-tools.spec +++ b/livecd-tools.spec @@ -17,7 +17,7 @@ Summary: Tools for building live CDs Name: livecd-tools Version: 31.0 -Release: 8%{?dist} +Release: 8.0.riscv64%{?dist} %if 0%{?fedora} Epoch: 1 %endif @@ -26,6 +26,9 @@ URL: https://github.com/livecd-tools/livecd-tools Source0: https://releases.pagure.org/%{name}/%{name}-%{version}.tar.gz Patch0: livecd-tools-31.0-py312-distutils-removal.patch +# RISCV (riscv64) +Patch1: test-fix.patch + BuildRequires: make %if %{with python2} BuildRequires: python2-devel @@ -64,6 +67,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 @@ -226,6 +231,10 @@ rm -rfv %{buildroot}%{_mandir}/man8/livecd-iso-to-* %endif %changelog +* Fri Mar 22 2024 David Abdurachmanov - 1:31.0-8.0.riscv64 +- Collect more information what is blocking mount point. +- Special bind-mounts can be lazy unmounted. + * Thu Jan 25 2024 Fedora Release Engineering - 1:31.0-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild diff --git a/test-fix.patch b/test-fix.patch new file mode 100644 index 0000000..f398aba --- /dev/null +++ b/test-fix.patch @@ -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