summaryrefslogtreecommitdiff
path: root/image/backends
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2024-05-22 11:25:19 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2024-10-04 10:43:49 -0500
commit43f8dc6aacf659ddb2c5d648c83b7d1ac87e1ad7 (patch)
treeb2745da17f01cd10630f61fbeddeee1b8166fde2 /image/backends
parent0077ccfbacef657b4027c1665a9588bf313dc7aa (diff)
downloadhorizon-43f8dc6aacf659ddb2c5d648c83b7d1ac87e1ad7.tar.gz
horizon-43f8dc6aacf659ddb2c5d648c83b7d1ac87e1ad7.tar.bz2
horizon-43f8dc6aacf659ddb2c5d648c83b7d1ac87e1ad7.tar.xz
horizon-43f8dc6aacf659ddb2c5d648c83b7d1ac87e1ad7.zip
image: ISO backend: Recursively umount if busy
If an image creation run is interrupted (i.e. ^C) and the target FSes aren't umounted, the ISO backend tries to umount them during creation. However, it doesn't recursively umount /dev or /sys, which leaves them mounted (with an EBUSY error). This leads to the fs::remove_all call clearing out /dev nodes, which has personally irked me many times. Now we retry with recursion when we hit EBUSY, so that this won't happen.
Diffstat (limited to 'image/backends')
-rw-r--r--image/backends/iso.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/image/backends/iso.cc b/image/backends/iso.cc
index 52f0367..00f5ae4 100644
--- a/image/backends/iso.cc
+++ b/image/backends/iso.cc
@@ -203,7 +203,9 @@ public:
*/
for(const std::string mount : {"dev", "proc", "sys"}) {
const std::string path = this->ir_dir + "/target/" + mount;
- ::umount(path.c_str());
+ if(::umount(path.c_str()) == EBUSY) {
+ run_command("umount", {"-R", path});
+ }
}
fs::remove_all(this->ir_dir, ec);
if(ec) {