Skip to content

plan9: keep fids per session and inodes per filesystem - #1492

Merged
svinota merged 1 commit into
svinota:masterfrom
kratos0718:plan9-per-session-state
Oct 2, 2026
Merged

svinota merged 1 commit into
svinota:masterfrom
kratos0718:plan9-per-session-state

Conversation

@kratos0718

Copy link
Copy Markdown
Contributor

Session.fid_table and Filesystem.inodes in pyroute2/plan9/filesystem.py are class attributes, so every session and every filesystem in the process share them. In 9P fids belong to one connection, and Plan9ClientSocket allocates them from 1, so two connections use the same fid numbers. With two servers in one process (each with its own client), the first client read the second server's file through its own fid, and the first server also served a file that only exists on the second:

first client reads its own fid: b'data that belongs to the second server'
first server exposes second server's file: b'data that belongs to the second server'

This moves both tables into __init__. The added test_servers_do_not_share_state in tests/test_core/test_plan9/test_basic.py fails on master and passes with the change. The plan9 tests pass and the pre-commit hooks (isort, black, flake8) are clean.

Session.fid_table and Filesystem.inodes were class attributes, so
every connection and every server in a process shared them. Clients
allocate fids from 1, so a second connection overwrote the first
one's fids, and a second server replaced the first server's root
inode and exposed its files.
@svinota

svinota commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Looks ok, merging. Thanks!

@svinota
svinota merged commit 4b0b073 into svinota:master Oct 2, 2026
47 of 49 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