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:
authorRobin Appelman <robin@icewind.nl>2022-02-25 18:11:38 +0300
committerRobin Appelman <robin@icewind.nl>2022-02-25 18:33:27 +0300
commitec15020777c9f0de248ced8b83fe48767c2919b6 (patch)
treea5980b6986c31c99649094cb7f20e74732688f2d /apps/dav/lib/Connector/Sabre/File.php
parentd08d0ebdda82bdbc8c5cc5f7432e98a913fa2321 (diff)
also handle expired pre-write shared lock on dav upload when not using part filesroot-setup-mountprovider
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/dav/lib/Connector/Sabre/File.php')
-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 28817b93b76..fa8a46e0530 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -173,7 +173,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)) {