containers / libkrun

A dynamic library providing Virtualization-based process isolation capabilities
Apache License 2.0
901 stars 74 forks source link

fs/macos: keep track of unlinked files #74

Closed slp closed 2 years ago

slp commented 2 years ago

When a file is unlinked while still opened, the server might lose access to it if it's expunged from LruCache, as we no longer have a cached path to re-open it.

To prevent this from happening, we add the map "pinned_files" where we keep track of unlinked but still referenced inodes. Once the inode is no longer referenced, the entry is removed from "pinned_files" and, as consequence, the associated "File" is dropped and the file descriptor closed.

Signed-off-by: Sergio Lopez slp@sinrega.org