Skip to content

Commit b2f9852

Browse files
committed
delay updating setup providers untill we register the mounts
otherwise the fallback to a full setup for a missing cached mount provider will lead to a race condition Signed-off-by: Robin Appelman <[email protected]>
1 parent 3d77e38 commit b2f9852

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/private/Files/SetupManager.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,6 @@ public function setupForPath(string $path, bool $includeChildren = false): void
414414

415415
$mounts = [];
416416
if (!in_array($cachedMount->getMountProvider(), $setupProviders)) {
417-
$setupProviders[] = $cachedMount->getMountProvider();
418417
$currentProviders[] = $cachedMount->getMountProvider();
419418
if ($cachedMount->getMountProvider()) {
420419
$mounts = $this->mountProviderCollection->getUserMountsForProviderClasses($user, [$cachedMount->getMountProvider()]);
@@ -429,7 +428,6 @@ public function setupForPath(string $path, bool $includeChildren = false): void
429428
$subCachedMounts = $this->userMountCache->getMountsInPath($user, $path);
430429
foreach ($subCachedMounts as $cachedMount) {
431430
if (!in_array($cachedMount->getMountProvider(), $setupProviders)) {
432-
$setupProviders[] = $cachedMount->getMountProvider();
433431
$currentProviders[] = $cachedMount->getMountProvider();
434432
if ($cachedMount->getMountProvider()) {
435433
$mounts = array_merge($mounts, $this->mountProviderCollection->getUserMountsForProviderClasses($user, [$cachedMount->getMountProvider()]));
@@ -442,6 +440,10 @@ public function setupForPath(string $path, bool $includeChildren = false): void
442440
}
443441
}
444442

443+
foreach ($currentProviders as $currentProvider) {
444+
$setupProviders[] = $currentProvider;
445+
}
446+
445447
if (count($mounts)) {
446448
$this->userMountCache->registerMounts($user, $mounts, $currentProviders);
447449
$this->setupForUserWith($user, function () use ($mounts) {

0 commit comments

Comments
 (0)