summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-11-16 17:07:05 +0100
committerGitHub <noreply@github.com>2020-11-16 17:07:05 +0100
commit8de8bd2326db850743c808172cc53b07d242ede7 (patch)
treec02d4b265bac9331bc7d5a8a14954641c73b411b /lib
parentfd3db61cff732ba96bc6cce208b90d79e5373cc0 (diff)
parentda7f445179ba682cea57be621caf0da3b7d637bc (diff)
downloadnextcloud-server-8de8bd2326db850743c808172cc53b07d242ede7.tar.gz
nextcloud-server-8de8bd2326db850743c808172cc53b07d242ede7.zip
Merge pull request #24076 from nextcloud/backport/23741/stable19
[stable19] Unlock when promoting to exclusive lock fails
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/View.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index ef8656258d1..0c0bef6600a 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -665,7 +665,13 @@ class View {
return false;
}
- $this->changeLock($path, ILockingProvider::LOCK_EXCLUSIVE);
+ try {
+ $this->changeLock($path, ILockingProvider::LOCK_EXCLUSIVE);
+ } catch (\Exception $e) {
+ // Release the shared lock before throwing.
+ $this->unlockFile($path, ILockingProvider::LOCK_SHARED);
+ throw $e;
+ }
/** @var \OC\Files\Storage\Storage $storage */
list($storage, $internalPath) = $this->resolvePath($path);