summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2019-01-22 15:32:48 +0100
committerRobin Appelman <robin@icewind.nl>2019-01-22 15:32:48 +0100
commitf69c2d1e8443ae23278fdf809b027f9713e3f868 (patch)
tree361e271348bec6466bf6db31b7a80a817edabb5d /lib
parentb35db6c784d236e1ba0da0dffccef3291df3bb19 (diff)
downloadnextcloud-server-f69c2d1e8443ae23278fdf809b027f9713e3f868.tar.gz
nextcloud-server-f69c2d1e8443ae23278fdf809b027f9713e3f868.zip
cleanup shared lock if changing to exclusive lock failed
Signed-off-by: Robin Appelman <robin@icewind.nl>
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 21df67cf557..6066aed411f 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -1137,7 +1137,13 @@ class View {
list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix);
if ($run and $storage) {
if (in_array('write', $hooks) || in_array('delete', $hooks)) {
- $this->changeLock($path, ILockingProvider::LOCK_EXCLUSIVE);
+ try {
+ $this->changeLock($path, ILockingProvider::LOCK_EXCLUSIVE);
+ } catch (LockedException $e) {
+ // release the shared lock we acquired before quiting
+ $this->unlockFile($path, ILockingProvider::LOCK_SHARED);
+ throw $e;
+ }
}
try {
if (!is_null($extraParam)) {