mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-23 01:37:27 +00:00
agent: Fix the issues with bind volumes
The mount type should be considered as empty if the value is `Some("none")`. Fixes: #10642 Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
This commit is contained in:
@@ -233,7 +233,7 @@ pub fn init_rootfs(
|
|||||||
// bind may be only specified in the oci spec options -> flags update r#type
|
// bind may be only specified in the oci spec options -> flags update r#type
|
||||||
let m = &{
|
let m = &{
|
||||||
let mut mbind = m.clone();
|
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.set_typ(Some("bind".to_string()));
|
||||||
}
|
}
|
||||||
mbind
|
mbind
|
||||||
@@ -397,6 +397,13 @@ fn mount_cgroups_v2(cfd_log: RawFd, m: &Mount, rootfs: &str, flags: MsFlags) ->
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_none_mount_type(typ: &Option<String>) -> bool {
|
||||||
|
match typ {
|
||||||
|
Some(t) => t == "none",
|
||||||
|
None => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn mount_cgroups(
|
fn mount_cgroups(
|
||||||
cfd_log: RawFd,
|
cfd_log: RawFd,
|
||||||
m: &Mount,
|
m: &Mount,
|
||||||
|
Reference in New Issue
Block a user