aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-11-09 11:00:46 +0100
committerGitHub <noreply@github.com>2020-11-09 11:00:46 +0100
commit005a132938556a238d3b3a617fc5a11dedbba24e (patch)
treec89180661737b69dcfbcdad6f492a3082dbe1237 /lib/private/Files
parent2f70a2507664897b1766a3bd915da1500fc59bfe (diff)
parenta66fb45c0b19c9f6fce55f06919562e99ceb1d6f (diff)
downloadnextcloud-server-005a132938556a238d3b3a617fc5a11dedbba24e.tar.gz
nextcloud-server-005a132938556a238d3b3a617fc5a11dedbba24e.zip
Merge pull request #23741 from Ashod/lock-leak
Unlock when promoting to exclusive lock fails
Diffstat (limited to 'lib/private/Files')
-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 16074a89ca8..fba412c37d4 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 */
[$storage, $internalPath] = $this->resolvePath($path);