diff options
author | Robin Appelman <robin@icewind.nl> | 2022-03-04 16:44:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-04 16:44:05 +0300 |
commit | 8b22a463e9b16282860991004430ba54e5e75dbc (patch) | |
tree | f7f66797543781441097697c7aef7b1245e0d206 /apps/dav/lib/Connector | |
parent | 821a0dc87594c717e785027b81134bf8783913c9 (diff) | |
parent | ec15020777c9f0de248ced8b83fe48767c2919b6 (diff) |
Merge pull request #31266 from nextcloud/root-setup-mountprovider
move root mount setup to mountproviders
Diffstat (limited to 'apps/dav/lib/Connector')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/File.php | 18 |
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 3a13dba5df6..4768fc3dc44 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -183,7 +183,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)) { |