diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-18 11:06:17 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-18 11:06:17 +0100 |
commit | a184e350d71d6ee94d8223311e5dbb4f869b4e3a (patch) | |
tree | 5fad3c7ee22b78fbeb438fa737b3af7e045c69ac /apps/dav/lib/Connector/Sabre | |
parent | f2724992fcb236b211f6e72aa7b3ac0dec5a7f3b (diff) | |
parent | 911763aad50e27f5d8c667fead8e9a7f6d852a9a (diff) | |
download | nextcloud-server-a184e350d71d6ee94d8223311e5dbb4f869b4e3a.tar.gz nextcloud-server-a184e350d71d6ee94d8223311e5dbb4f869b4e3a.zip |
Merge remote-tracking branch 'origin/master' into filecache-extension
Diffstat (limited to 'apps/dav/lib/Connector/Sabre')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/File.php | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index bc72fd24e71..3ce305d75f3 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -252,10 +252,22 @@ class File extends Node implements IFile { try { $this->changeLock(ILockingProvider::LOCK_EXCLUSIVE); } catch (LockedException $e) { - if ($needsPartFile) { - $partStorage->unlink($internalPartPath); + // during very large uploads, the shared lock we got at the start might have been expired + // meaning that the above lock can fail not just only because somebody else got a shared lock + // or because there is no existing shared lock to make exclusive + // + // Thus we try to get a new exclusive lock, if the original lock failed because of a different shared + // lock this will still fail, if our original shared lock expired the new lock will be successful and + // the entire operation will be safe + + try { + $this->acquireLock(ILockingProvider::LOCK_EXCLUSIVE); + } catch (LockedException $e) { + if ($needsPartFile) { + $partStorage->unlink($internalPartPath); + } + throw new FileLocked($e->getMessage(), $e->getCode(), $e); } - throw new FileLocked($e->getMessage(), $e->getCode(), $e); } // rename to correct path |