Skip to content

Recognize one SMB share reached at several addresses, and share its index #335

Open

Description

@vdavid

One SMB share reached at several addresses (for example the LAN IP, a VPN address like Tailscale, and the mDNS name) becomes several volumes today. smb_volume_id keys on the address as mounted, so each alias gets its own index, writer, and scan.

What it costs (docs/notes/performance/thread-and-connection-inventory-2026-09-22.md): for each extra alias, two writer threads, an FSEvents stream, 32 MiB of page-slab budget, and a duplicate scan over the network. It only affects setups that reach one share at 2+ addresses, and nobody has measured the idle CPU and RAM of that.

How to recognize the same share: a fingerprint read after connecting

  • ServerGuid: every SMB2/3 server sends a 16-byte GUID in its NEGOTIATE response. It identifies the server itself, not the address, and Samba and Windows both keep it across restarts. smb2 already parses and exposes it (server_guid in the negotiate parameters); Cmdr doesn't use it yet.
  • Share name: compared case-insensitively.
  • The underlying volume: FileFsVolumeInformation gives a volume serial number and creation time, as a second fingerprint that has to match too.

Design sketch: an alias-adoption layer

  • After a connection, look for an existing volume with the same fingerprint. If there is one, adopt its index instead of creating a new one.
  • Don't use same_server* as a key: it's a predicate that depends on live mDNS state.

Risks

  • Cloned servers: two different servers made from the same VM or container image can share a GUID, if Samba's state was baked into the image. Cmdr's own Docker SMB fixtures are that case. Requiring GUID + share name + volume serial/creation time to all match makes a false merge very unlikely. A false merge is the dangerous direction; failing to merge only costs duplication, like today.
  • Failover clusters: they present one GUID across nodes, and merging is correct there.
  • Volume identity touches indexing, credentials, and the mount watcher, so this needs a short spec first.

Moved out of #92 (the idle-cost issue) as an edge case of a specific setup.

Activity

  1. added
    bug
    indexing
    smb
    on Sep 30, 2026
  2. added a commit that references this issue on Sep 30, 2026
  3. added
    startable
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugclaude-createdindexingsmbstartable

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions