Skip to content

lisafs: move implementation to connections#13180

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test/cl915234536
Open

lisafs: move implementation to connections#13180
copybara-service[bot] wants to merge 1 commit into
masterfrom
test/cl915234536

Conversation

@copybara-service
Copy link
Copy Markdown

lisafs: move implementation to connections

The lisafs wire protocol already encodes the supported message list and the max message size per-mount on MountResp, but the server-side implementation reads both off a server-wide ServerImpl and reads ServerOpts off Server, so a custom implementation that needs to advertise different MIDs or run with different "OnDeleted" semantics has to bring its own lisafs.Server. That multi-Server shape carries its own renameMu, filesystem tree, and per-node opsMu instead of sharing them across mounts.

This moves Mount, SupportedMessages, MaxMessageSize, and the former ServerOpts behind a per-Connection ConnectionImpl. Server keeps the shared renameMu, filesystem tree, connection lifecycle, and an opaque implementation value for existing fsgofer config access, while each Connection reads its supported MIDs from its ConnectionImpl and caches hot-path configuration such as max message size and ConnectionOpts at startup. Stock fsgofer behavior is unchanged because LisafsServer remains the server-wide config carrier and hands out a stock connection implementation.

This is a precursor to a follow-up rework of #12950 that drops the multi-Server fan-out and lets LisafsServer choose a per-mount ConnectionImpl that returns the backend ControlFDImpl, all inside the single shared lisafs.Server.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#13158 from shayonj:s/lisafs-per-connection-opts ead4588

The lisafs wire protocol already encodes the supported message list and the max message size per-mount on MountResp, but the server-side implementation reads both off a server-wide ServerImpl and reads ServerOpts off Server, so a custom implementation that needs to advertise different MIDs or run with different "OnDeleted" semantics has to bring its own lisafs.Server. That multi-Server shape carries its own renameMu, filesystem tree, and per-node opsMu instead of sharing them across mounts.

This moves Mount, SupportedMessages, MaxMessageSize, and the former ServerOpts behind a per-Connection ConnectionImpl. Server keeps the shared renameMu, filesystem tree, connection lifecycle, and an opaque implementation value for existing fsgofer config access, while each Connection reads its supported MIDs from its ConnectionImpl and caches hot-path configuration such as max message size and ConnectionOpts at startup. Stock fsgofer behavior is unchanged because LisafsServer remains the server-wide config carrier and hands out a stock connection implementation.

This is a precursor to a follow-up rework of #12950 that drops the multi-Server fan-out and lets LisafsServer choose a per-mount ConnectionImpl that returns the backend ControlFDImpl, all inside the single shared lisafs.Server.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#13158 from shayonj:s/lisafs-per-connection-opts ead4588
PiperOrigin-RevId: 915234536
@copybara-service copybara-service Bot added the exported Issue was exported automatically label May 14, 2026
Copy link
Copy Markdown
Contributor

@shayonj shayonj left a comment

Choose a reason for hiding this comment

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

This is def cleaner, thank you for taking it on. I was staring to wonder about Server.impl and it'use other than carrying fsgofer config.

I guess if we are consolidating this path, I’m wondering whether the #12950 follow-up should route connection creation through a small per-mount factory/extension that returns both ConnectionImpl and ConnectionOpts. That seems to fit this API well because CreateConnection needs the implementation before Mount anyway, since MaxMessageSize is cached at connection boot

That also seems like it would compose well with the per-mount diretfs opt-out (13098). The factory can build the stock fsgofer impl with DonateMountPointFD disabled only for mounts that suppress directfs, while custom backends can return an impl that does not donate a host fs at all.

One possible behavioral thought I have is if Connection should cache/enforce SupportedMessages server-side too? The client respects the advertised list, but with mixed implementations on one shared server, making handleMsg reject non-advertised MIDs would make the per-connection protocol surface source of truth?

Comment thread pkg/lisafs/connection.go
// will fail with EROFS.
readonly bool
// opts is the cached value of impl.ConnectionOpts().
opts ConnectionOpts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: opts is passed into CreateConnection now rather than read from impl.ConnectionOpts IIUC?

// MaxMessageSize implements lisafs.MaxMessageSize.
func (s *testServer) MaxMessageSize() uint32 {
// ConnectionOpts implements lisafs.ConnectionImpl.ConnectionOpts.
func (s *testConnImpl) ConnectionOpts() lisafs.ConnectionOpts {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like this method is stale now that ConnectionImpl no longer has ConnectionOpts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant