mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-06 10:34:41 +00:00
agent: Handle EINVAL error when umounting container rootfs
Container/Sandbox clean up should not fail if root FS is not mounted. This PR handles EINVAL errors when umount2 is called. Fixes: #10166 Signed-off-by: Silenio Quarti <silenio_quarti@ca.ibm.com>
This commit is contained in:
parent
74662a0721
commit
0dd16e6b25
@ -1306,7 +1306,14 @@ impl BaseContainer for LinuxContainer {
|
|||||||
.to_string()
|
.to_string()
|
||||||
.as_str(),
|
.as_str(),
|
||||||
MntFlags::MNT_DETACH,
|
MntFlags::MNT_DETACH,
|
||||||
)?;
|
)
|
||||||
|
.or_else(|e| {
|
||||||
|
if e.ne(&nix::Error::EINVAL) {
|
||||||
|
return Err(anyhow!(e));
|
||||||
|
}
|
||||||
|
warn!(self.logger, "rootfs not mounted");
|
||||||
|
Ok(())
|
||||||
|
})?;
|
||||||
fs::remove_dir_all(&self.root)?;
|
fs::remove_dir_all(&self.root)?;
|
||||||
|
|
||||||
let cgm = self.cgroup_manager.as_mut();
|
let cgm = self.cgroup_manager.as_mut();
|
||||||
|
Loading…
Reference in New Issue
Block a user