Skip to content

Commit

Permalink
vmm: fix tmpfs bind dir empty
Browse files Browse the repository at this point in the history
When the mounted hostpath is tmpfs or when mounting a secret, the container cannot access the data. These two types of mounts are tmpfs, and due to memory isolation between the host and the virtual machine, the virtual machine will reallocate tmpfs, resulting in empty data.

Fix:Except for empty dir allocated by memory, all other tmpfs are bind-mounted into the virtual machine.

Signed-off-by: MorningTZH <morningtzh@yeah.net>
  • Loading branch information
morningtzh committed Jun 24, 2024
1 parent 76fcfa2 commit 68e38c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vmm/sandbox/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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 empty-dir use container tmpfs
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

0 comments on commit 68e38c0

Please sign in to comment.