diff options
author | Robin Appelman <robin@icewind.nl> | 2022-02-25 18:11:38 +0300 |
---|---|---|
committer | blizzz (Rebase PR Action) <blizzz@users.noreply.github.com> | 2022-03-10 20:17:21 +0300 |
commit | b05c9fe369643677c242e7e8362c005b52c516cc (patch) | |
tree | e32ddab45f156286f0268ff7ca36d5566cd3deab /apps/dav/lib | |
parent | 90c27a7d3048efaa8c7e30b71df037c21e3bd3ab (diff) |
also handle expired pre-write shared lock on dav upload when not using part filess3-primary-ci-23
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/dav/lib')
-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 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)) { |