From f5d7a44dcab25e12b06d15fe8dd638ff05497006 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 15 Jan 2026 18:12:44 +0100 Subject: [PATCH 1/2] fix: only refresh mounts once per user Signed-off-by: Robin Appelman --- lib/private/Files/SetupManager.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php index c8945de7caed1..ff204131fb00c 100644 --- a/lib/private/Files/SetupManager.php +++ b/lib/private/Files/SetupManager.php @@ -72,6 +72,8 @@ class SetupManager implements ISetupManager { private array $setupUsers = []; // List of users for which all mounts are setup private array $setupUsersComplete = []; + // List of users for which we've already refreshed the non-authoritative mounts + private array $usersMountsUpdated = []; /** * An array of provider classes that have been set up, indexed by UserUID. * @@ -237,6 +239,10 @@ function ($mountPoint, IStorage $storage, IMountPoint $mount) use ($reSharingEna * Update the cached mounts for all non-authoritative mount providers for a user. */ private function updateNonAuthoritativeProviders(IUser $user): void { + if (isset($this->usersMountsUpdated[$user->getUID()])) { + return; + } + // prevent recursion loop from when getting mounts from providers ends up setting up the filesystem static $updatingProviders = false; if ($updatingProviders) { @@ -257,6 +263,7 @@ private function updateNonAuthoritativeProviders(IUser $user): void { $mount = $this->mountProviderCollection->getUserMountsForProviderClasses($user, $providerNames); $this->userMountCache->registerMounts($user, $mount, $providerNames); + $this->usersMountsUpdated[$user->getUID()] = true; $updatingProviders = false; } @@ -726,6 +733,7 @@ public function tearDown(): void { $this->setupUserMountProviders = []; $this->setupMountProviderPaths = []; $this->fullSetupRequired = []; + $this->usersMountsUpdated = []; $this->rootSetup = false; $this->mountManager->clear(); $this->userMountCache->clear(); From 7064ff035f3b6e0c8517f53503c19bc40d233d13 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 15 Jan 2026 18:13:15 +0100 Subject: [PATCH 2/2] fix: also use authoritative mount info for setupForProvider Signed-off-by: Robin Appelman --- lib/private/Files/SetupManager.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php index ff204131fb00c..e058be0663b93 100644 --- a/lib/private/Files/SetupManager.php +++ b/lib/private/Files/SetupManager.php @@ -687,8 +687,13 @@ public function setupForProvider(string $path, array $providers): void { } if (!$providersAreAuthoritative && $this->fullSetupRequired($user)) { - $this->setupForUser($user); - return; + if ($this->optimizeAuthoritativeProviders) { + $this->updateNonAuthoritativeProviders($user); + $this->markUserMountsCached($user); + } else { + $this->setupForUser($user); + return; + } } $this->eventLogger->start('fs:setup:user:providers', 'Setup filesystem for ' . implode(', ', $providers));