Skip to content

Commit

Permalink
agent: Fix the issues with bind volumes
Browse files Browse the repository at this point in the history
The mount type should be considered as empty if the value is
`Some("none")`.

Fixes: kata-containers#10642

Signed-off-by: Xuewei Niu <[email protected]>
  • Loading branch information
justxuewei committed Dec 10, 2024
1 parent 59ed19e commit 3fb91dd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/agent/rustjail/src/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ pub fn init_rootfs(
// bind may be only specified in the oci spec options -> flags update r#type
let m = &{
let mut mbind = m.clone();
if mbind.typ().is_none() && flags & MsFlags::MS_BIND == MsFlags::MS_BIND {
if is_none_mount_type(mbind.typ()) && flags & MsFlags::MS_BIND == MsFlags::MS_BIND {
mbind.set_typ(Some("bind".to_string()));
}
mbind
Expand Down Expand Up @@ -397,6 +397,13 @@ fn mount_cgroups_v2(cfd_log: RawFd, m: &Mount, rootfs: &str, flags: MsFlags) ->
Ok(())
}

fn is_none_mount_type(typ: &Option<String>) -> bool {
match typ {
Some(t) => t == "none",
None => true,
}
}

fn mount_cgroups(
cfd_log: RawFd,
m: &Mount,
Expand Down

0 comments on commit 3fb91dd

Please sign in to comment.