Skip to content

Commit bb47ca1

Browse files
authored
Merge pull request #138 from morningtzh/fix-tmpfs
vmm: fix tmpfs bind dir empty
2 parents 5958124 + e69ee45 commit bb47ca1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

vmm/sandbox/src/storage/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ where
6464
// handle tmpfs mount
6565
let mount_info = get_mount_info(&m.source).await?;
6666
if let Some(mi) = mount_info {
67-
if mi.fs_type == "tmpfs" {
67+
// Only allow use tmpfs in emptyDir
68+
if mi.fs_type == "tmpfs" && mi.mount_point.contains("kubernetes.io~empty-dir") {
6869
self.handle_tmpfs_mount(&id, container_id, m, &mi).await?;
6970
return Ok(());
7071
}
@@ -317,6 +318,7 @@ where
317318
}
318319

319320
pub struct MountInfo {
321+
pub mount_point: String,
320322
pub fs_type: String,
321323
pub options: Vec<String>,
322324
}

vmm/sandbox/src/storage/mount.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ pub async fn get_mount_info(mount_point: &str) -> Result<Option<MountInfo>> {
4747
if mp == mount_point {
4848
let fs_type = fields[2].to_string();
4949
let options = fields[3].split(',').map(|x| x.to_string()).collect();
50-
return Ok(Some(MountInfo { fs_type, options }));
50+
return Ok(Some(MountInfo {
51+
mount_point: mp,
52+
fs_type,
53+
options,
54+
}));
5155
}
5256
}
5357
Ok(None)

0 commit comments

Comments
 (0)