Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2022-04-14 14:17:16 +0300
committerGitHub <noreply@github.com>2022-04-14 14:17:16 +0300
commitea3a9ba86eba31bc127ea91fa706546d991f4984 (patch)
treeb01d2f800a52e3883adb9314104ccc5c3f7bbac6 /apps/dav/lib
parent69262f83a7f7a9b3e82526b22e869eb71eb70d08 (diff)
parentb05c9fe369643677c242e7e8362c005b52c516cc (diff)
Merge pull request #31453 from nextcloud/s3-primary-ci-23
[stable23] Run tests with primary object storage in CI + large upload fixes
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/Connector/Sabre/File.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php
index bf7e469a0c0..963a07a55fb 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -184,7 +184,23 @@ class File extends Node implements IFile {
[$storage, $internalPath] = $this->fileView->resolvePath($this->path);
try {
if (!$needsPartFile) {
- $this->changeLock(ILockingProvider::LOCK_EXCLUSIVE);
+ try {
+ $this->changeLock(ILockingProvider::LOCK_EXCLUSIVE);
+ } catch (LockedException $e) {
+ // 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 $ex) {
+ throw new FileLocked($e->getMessage(), $e->getCode(), $e);
+ }
+ }
}
if (!is_resource($data)) {