Skip to content

Make cache private for each mount and enforce LRU eviction.#3

Merged
rslota merged 1 commit into
mainfrom
rafal.s/revup/main/cache-eviction
Feb 26, 2026
Merged

Make cache private for each mount and enforce LRU eviction.#3
rslota merged 1 commit into
mainfrom
rafal.s/revup/main/cache-eviction

Conversation

@rslota
Copy link
Copy Markdown

@rslota rslota commented Feb 25, 2026

No description provided.

@rslota
Copy link
Copy Markdown
Author

rslota commented Feb 25, 2026

Reviews in this chain:
#3 Make cache private for each mount and enforce LRU eviction.

@rslota
Copy link
Copy Markdown
Author

rslota commented Feb 25, 2026

# head base diff date summary
0 64ee52f3 a9bc569b diff Feb 25 18:48 PM 8 files changed, 746 insertions(+), 63 deletions(-)
1 3b1aca2e a9bc569b diff Feb 26 15:08 PM 3 files changed, 9 insertions(+), 3 deletions(-)

Comment thread src/filesystem.rs
.collect();
let n_files = bodies.len();

let handle = thread::spawn(move || {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd probably want to use async at this point (possibly Tokio, since it's the most popular, or some other runtime if there's some merit behind a particular one), but that's definitely out of scope of this PR

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just moved, I didn't add this in this PR. I think that would be bigger rewrite 🤷

Comment thread src/mount_cache.rs
}
}

fn is_process_alive(pid: u32) -> bool {
Copy link
Copy Markdown

@erszcz erszcz Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I've known it myself, but seems legit:

kill(pid, 0) returns -1 with errno == EPERM if the process exists but belongs to another user. The current check would treat that as "dead" and delete the directory. Should check errno != ESRCH instead:

fn is_process_alive(pid: u32) -> bool {
    let ret = unsafe { libc::kill(pid as i32, 0) };
    if ret == 0 {
        return true;
    }
    // EPERM means process exists but we lack permission to signal it
    std::io::Error::last_os_error().raw_os_error() != Some(libc::ESRCH)
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair, I mostly ignored this because in our cases that can never happen, but fine 🤷

Copy link
Copy Markdown

@erszcz erszcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general, but might be worth checking the is_process_alive details

@rslota rslota force-pushed the rafal.s/revup/main/cache-eviction branch from 64ee52f to 3b1aca2 Compare February 26, 2026 14:08
@rslota rslota merged commit d2e4b3e into main Feb 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants