Use md5 for lock key

This commit is contained in:
Vincent Petry 2015-05-13 11:36:40 +02:00 committed by Robin Appelman
parent 5edf294ce5
commit 0775e9c1ca
2 changed files with 16 additions and 4 deletions

View File

@ -630,7 +630,7 @@ abstract class Common implements Storage {
* @throws \OCP\Lock\LockedException
*/
public function acquireLock($path, $type, ILockingProvider $provider) {
$provider->acquireLock($this->getId() . '::' . $path, $type);
$provider->acquireLock(md5($this->getId() . '::' . $path), $type);
}
/**
@ -639,6 +639,6 @@ abstract class Common implements Storage {
* @param \OCP\Lock\ILockingProvider $provider
*/
public function releaseLock($path, $type, ILockingProvider $provider) {
$provider->releaseLock($this->getId() . '::' . $path, $type);
$provider->releaseLock(md5($this->getId() . '::' . $path), $type);
}
}

View File

@ -1639,14 +1639,26 @@ class View {
private function lockPath($path, $type) {
$mount = $this->getMount($path);
if ($mount) {
$mount->getStorage()->acquireLock($mount->getInternalPath($this->getAbsolutePath($path)), $type, $this->lockingProvider);
$mount->getStorage()->acquireLock(
$mount->getInternalPath(
$this->getAbsolutePath($path)
),
$type,
$this->lockingProvider
);
}
}
private function unlockPath($path, $type) {
$mount = $this->getMount($path);
if ($mount) {
$mount->getStorage()->releaseLock($mount->getInternalPath($this->getAbsolutePath($path)), $type, $this->lockingProvider);
$mount->getStorage()->releaseLock(
$mount->getInternalPath(
$this->getAbsolutePath($path)
),
$type,
$this->lockingProvider
);
}
}