diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2024-05-22 11:25:19 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2024-10-04 10:43:49 -0500 |
commit | 43f8dc6aacf659ddb2c5d648c83b7d1ac87e1ad7 (patch) | |
tree | b2745da17f01cd10630f61fbeddeee1b8166fde2 /image/backends | |
parent | 0077ccfbacef657b4027c1665a9588bf313dc7aa (diff) | |
download | horizon-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.cc | 4 |
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) { |