diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index ef8656258d..0c0bef6600 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);