summaryrefslogtreecommitdiff
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-05-22 11:25:19 -0500
commit2a99f950ff3eb863c913a2bf25911933670c47de (patch)
treee2085c47a9bcceffb4036b81fa06f0c62af049d3
parent75db43b7fc8a049090a6f77a31a658a718268ac7 (diff)
downloadhorizon-2a99f950ff3eb863c913a2bf25911933670c47de.tar.gz
horizon-2a99f950ff3eb863c913a2bf25911933670c47de.tar.bz2
horizon-2a99f950ff3eb863c913a2bf25911933670c47de.tar.xz
horizon-2a99f950ff3eb863c913a2bf25911933670c47de.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.
-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) {