Skip to content

fix(sidebar): deduplicate GVfs network mounts in devices - #2449

Merged
l0gicgate merged 3 commits into
mainfrom
fix/2389-deduplicate-gvfs-mounts
Nov 16, 2026
Merged

l0gicgate merged 3 commits into
mainfrom
fix/2389-deduplicate-gvfs-mounts

Conversation

@JoeJoeflyn

@JoeJoeflyn JoeJoeflyn commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Deduplicate volume monitor mounts by root URI and location so that restarting gvfs-daemon.service (e.g. via Omarchy's suspend hook /usr/lib/systemd/system-sleep/unmount-fuse) does not accumulate duplicate entries for network shares in the Devices sidebar.

When gvfsd restarts, client-side GDaemonVolumeMonitor keeps the old mounts in memory. When remounted, a new GMount instance is created with a different D-Bus ID and prepended to the monitor's mount list. Deduplicating by root URI and location preserves the newest active mount and discards stale duplicates.

Visual evidence

evidence_comparison

How to test

  1. Mount a network share (e.g., gio mount smb://<server>/<share> or gio mount sftp://127.0.0.1/).
  2. Open Strata and verify the share appears under Devices.
  3. Restart the GVfs daemon with systemctl --user restart gvfs-daemon.service and mount the share again.

Expected result:
The share appears exactly once under Devices rather than creating duplicate rows for each restart.

Related issue

Closes #2389

Deduplicate volume monitor mounts by root URI and location so that restarting gvfs-daemon (such as on wake from suspend) does not accumulate duplicate entries for network shares in the Devices sidebar.

Fixes #2389
@github-actions github-actions Bot added the fix label Nov 14, 2026
The root URI filter in mounts_without_listed_volumes repeated the
location filter in mounts_without_volumes, since a mount's location is
derived from its root. Keep the location filter and note why the first
listed mount wins.
@l0gicgate

Copy link
Copy Markdown
Contributor

Review and cleanup

Merged main at 8ff4079e, no conflicts.

Review against the description and #2389. The deduplication works. GVfs's GDaemonVolumeMonitor::mount_added prepends the new GDaemonMount (client/gdaemonvolumemonitor.c), so keeping the first mount per location keeps the live one. In a long-lived GIO client with three listed copies after two gvfsd restarts, unmounting the first copy succeeds, so Disconnect on the remaining row acts on the real mount. No review comments or threads existed.

Fixes pushed

  • a282aaa3 refactor(sidebar): deduplicate device mounts once by location. The root URI filter in mounts_without_listed_volumes repeated the Location filter in mounts_without_volumes, because the location comes from the same root. Kept the location filter, reverted devices.rs to main, and added a one-line comment on why the first mount wins.

Manual verification (private Xvfb and private D-Bus, rclone serve ftp share mounted with gio mount -a ftp://127.0.0.1:2121/, gvfsd in that session killed and the share remounted twice): main shows 127.0.0.1:2121 three times under Devices; this branch shows it once.

Tests: none added. The behaviour depends on GIO state left by a gvfsd restart, which unit tests cannot fake, and a test of a generic first-per-key filter would only restate HashSet.

Validation

  • ./scripts/test-headless.py -- ui::window::tests::sidebar ui::window::devices::tests ui::window::device_order: 39 passed
  • ./scripts/quality.sh fmt, ./scripts/quality.sh clippy: clean
  • scripts/code-health.sh src/ui/window/sidebar_devices.rs: 9.68, unchanged from main
  • Not run: qa.sh (no scenario covers GVfs mounts)

Follow-ups outside this PR

  • Sidebar shows duplicate entries for GVFS SMB mounts after gvfs-daemon restarts #2389 also expects a share to disappear when gvfs-daemon goes away. GIO keeps the old entries after a restart: after a successful unmount the client still listed two stale copies while gio mount -l reported none. So with no remount, or after Disconnect, one stale row remains, as it did before this PR. Dropping it needs the GVfs mount tracker queried over D-Bus.

CI: all checks green on a282aaa3.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sidebar shows duplicate entries for GVFS SMB mounts after gvfs-daemon restarts

2 participants