block/file: be more defensive about the backing file

Open Beginner friendly
#1,011 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
66/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust

Research direction

Start in lib/propolis/src/block/file.rs around line 175 and read how the backing file is opened, then check Rust's Unix OpenOptionsExt::custom_flags documentation. Add the requested exclusive-opening behavior and verify that concurrent writable opens are rejected while the intended read-only behavior remains clear.

Written by the indexing model from the issue text.

Description

enhancement storage

in file.rs we'll just open the backing file for whatever permissions the disk should have: https://github.com/oxidecomputer/propolis/blob/2dc643742f82d2e072a1281dab23ba2bfdcee440/lib/propolis/src/block/file.rs#L175

but we don't get O_EXCL in here anywhere. I'd thought offhandedly that we could take advantage of that for a very weird one-off test configuration (opening a volume from multiple propolises concurrently), but this was appropriately worrying to everyone else with more calibrated fear-o-meter. we should probably open with O_EXCL, which I think we can plumb in with custom_flags()

if Propolis is told to open a file for writing by multiple VMs concurrently that's likely a serious operator error. I'm less opposed to concurrent read-only opens, but caution seems more appropriate here. I've definitely corrupted guests doing this nonsense locally before.

Dominant language
Rust
Stars
270
Forks
42
Avg merge
4d 5h
Merged PRs (30d)
6

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from oxidecomputer/propolis

All issues in oxidecomputer/propolis

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.