Skip to content

Commit

Permalink
Merge pull request #138 from morningtzh/fix-tmpfs
Browse files Browse the repository at this point in the history
vmm: fix tmpfs bind dir empty
  • Loading branch information
Burning1020 authored Jul 23, 2024
2 parents 5958124 + e69ee45 commit bb47ca1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion vmm/sandbox/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ where
// handle tmpfs mount
let mount_info = get_mount_info(&m.source).await?;
if let Some(mi) = mount_info {
if mi.fs_type == "tmpfs" {
// Only allow use tmpfs in emptyDir
if mi.fs_type == "tmpfs" && mi.mount_point.contains("kubernetes.io~empty-dir") {
self.handle_tmpfs_mount(&id, container_id, m, &mi).await?;
return Ok(());
}
Expand Down Expand Up @@ -317,6 +318,7 @@ where
}

pub struct MountInfo {
pub mount_point: String,
pub fs_type: String,
pub options: Vec<String>,
}
6 changes: 5 additions & 1 deletion vmm/sandbox/src/storage/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ pub async fn get_mount_info(mount_point: &str) -> Result<Option<MountInfo>> {
if mp == mount_point {
let fs_type = fields[2].to_string();
let options = fields[3].split(',').map(|x| x.to_string()).collect();
return Ok(Some(MountInfo { fs_type, options }));
return Ok(Some(MountInfo {
mount_point: mp,
fs_type,
options,
}));
}
}
Ok(None)
Expand Down

0 comments on commit bb47ca1

Please sign in to comment.