Skip to content

nfsd: validate NFS open state without share reservations - #144

Open
stevephodgson wants to merge 1 commit into
pynfs2from
pynfs3
Open

nfsd: validate NFS open state without share reservations#144
stevephodgson wants to merge 1 commit into
pynfs2from
pynfs3

Conversation

@stevephodgson

Copy link
Copy Markdown
Collaborator

pynfs CLOSE3/5/6 and OPCF1/4/5/6 showed that CLOSE and OPEN_CONFIRM accepted bad owner seqids and invalid stateid generations. RD10/11 accepted stale and old stateids, while SATT4 resized through a read-only open.

Track open owners and stateid generations in memory, validate WRITE, READ, CLOSE, OPEN_CONFIRM, and SETATTR(SIZE), preserve OPEN and CLOSE replay behavior, and recover CLOSE for staged files after an nfsd restart.

This adds new state (openStateStore), but it is server-local and in-memory only, not durable or shared across nfsd instances. That is acceptable because a write-open's actual data (the staging file it protects) is itself local-disk and per-host already; a write-open cannot outlive its host regardless of what nfsd tracks about it, so persisting the open state anywhere more durable than the staging file it describes would not add any real guarantee.

Add unit tests to cover the anonymous special stateid handling.

Do not retain or enforce share-deny reservations. They do not match TernFS last-closer-wins semantics and would only be consistent within one nfsd process.

pynfs CLOSE3/5/6 and OPCF1/4/5/6 showed that CLOSE and OPEN_CONFIRM
accepted bad owner seqids and invalid stateid generations. RD10/11
accepted stale and old stateids, while SATT4 resized through a
read-only open.

Track open owners and stateid generations in memory, validate WRITE,
READ, CLOSE, OPEN_CONFIRM, and SETATTR(SIZE), preserve OPEN and CLOSE
replay behavior, and recover CLOSE for staged files after an nfsd
restart.

This adds new state (openStateStore), but it is server-local and
in-memory only, not durable or shared across nfsd instances. That is
acceptable because a write-open's actual data (the staging file it
protects) is itself local-disk and per-host already; a write-open
cannot outlive its host regardless of what nfsd tracks about it, so
persisting the open state anywhere more durable than the staging file
it describes would not add any real guarantee.

Add unit tests to cover the anonymous special stateid handling.

Do not retain or enforce share-deny reservations. They do not match
TernFS last-closer-wins semantics and would only be consistent within
one nfsd process.
@stevephodgson
stevephodgson requested a review from mcrnic August 14, 2026 17:56
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.

1 participant