Skip to content

Fix: --unmount-all now triggers pending staged upgrade#1975

Closed
tyrielv wants to merge 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/fix-unmountall-upgrade-check
Closed

Fix: --unmount-all now triggers pending staged upgrade#1975
tyrielv wants to merge 1 commit into
microsoft:masterfrom
tyrielv:tyrielv/fix-unmountall-upgrade-check

Conversation

@tyrielv
Copy link
Copy Markdown
Contributor

@tyrielv tyrielv commented May 15, 2026

Problem

When an installer runs while mounts are active, it stages new files to
PendingUpgrade\ instead of replacing files in-place. The service is
supposed to apply the upgrade when all mounts are unmounted.

This works correctly for gvfs unmount because each unmount sends an
UnregisterRepoRequest to the service, which triggers
TryDeferredPendingUpgradeCheck in RequestHandler.

However, gvfs service --unmount-all sets SkipUnregister = true on
each unmount (to preserve automount registration), so no message reaches
the service
and the staged upgrade is never applied — it sits in
PendingUpgrade\ indefinitely until the next service restart.

Fix

New PendingUpgradeCheckRequest named pipe message (3 files, ~65 lines):

  1. NamedPipeMessages.cs — Added PendingUpgradeCheckRequest with
    header, FromMessage/ToMessage, and Response (follows existing
    EnableAndAttachProjFSRequest pattern).

  2. RequestHandler.cs — Handle the new message by calling the existing
    TryDeferredPendingUpgradeCheck (same debounced timer that individual
    unmounts use) and returning a success response.

  3. ServiceVerb.cs — After the --unmount-all loop completes, send
    PendingUpgradeCheckRequest to the service pipe. Placed before the
    failure exit path so partial unmount failures still trigger the check.
    Notification failure is treated as a warning (unmounts themselves succeeded).

The service-side PendingUpgradeHandler.TryApplyPendingUpgrade already
checks for running GVFS.Mount processes and defers if any are present,
so sending the notification even after partial unmount failures is safe.

Test

Added unmount-all-triggers-upgrade scenario to the CI upgrade test matrix
(upgrade-tests.yaml). It follows the same pattern as staging-upgrade
but uses gvfs service --unmount-all instead of per-repo unmount, then
polls for PendingUpgrade\ directory removal to confirm the upgrade
applied without needing a service restart.

'gvfs service --unmount-all' sets SkipUnregister on each unmount to
preserve automount registration. This meant no UnregisterRepoRequest
reached the service, so RequestHandler never called
TryDeferredPendingUpgradeCheck and staged upgrades were never applied.

Add PendingUpgradeCheckRequest message type. ServiceVerb sends it after
the --unmount-all loop completes so the service can schedule the same
deferred upgrade check that individual unmounts trigger.

Also add 'unmount-all-triggers-upgrade' scenario to upgrade-tests.yaml
CI matrix to cover this path end-to-end.

Assisted-by: Claude Opus 4.6
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
@tyrielv tyrielv force-pushed the tyrielv/fix-unmountall-upgrade-check branch from e33da2a to af4eb1c Compare May 15, 2026 17:44
@tyrielv tyrielv marked this pull request as ready for review May 15, 2026 17:50
@tyrielv
Copy link
Copy Markdown
Contributor Author

tyrielv commented May 15, 2026

Closing for now - this approach doesn't work when upgrading from older version to the first version that has this.

@tyrielv tyrielv closed this May 15, 2026
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