Merge pull request #9566 from nextcloud/backport/9395/stable13
[stable13] cleanup locks in scanner on error
This commit is contained in:
commit
fe20bb4b27
|
@ -332,15 +332,18 @@ class Scanner extends BasicEmitter implements IScanner {
|
|||
$this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
|
||||
}
|
||||
}
|
||||
$data = $this->scanFile($path, $reuse, -1, null, $lock);
|
||||
if ($data and $data['mimetype'] === 'httpd/unix-directory') {
|
||||
$size = $this->scanChildren($path, $recursive, $reuse, $data['fileid'], $lock);
|
||||
$data['size'] = $size;
|
||||
}
|
||||
if ($lock) {
|
||||
if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) {
|
||||
$this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
|
||||
$this->storage->releaseLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
|
||||
try {
|
||||
$data = $this->scanFile($path, $reuse, -1, null, $lock);
|
||||
if ($data and $data['mimetype'] === 'httpd/unix-directory') {
|
||||
$size = $this->scanChildren($path, $recursive, $reuse, $data['fileid'], $lock);
|
||||
$data['size'] = $size;
|
||||
}
|
||||
} finally {
|
||||
if ($lock) {
|
||||
if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) {
|
||||
$this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
|
||||
$this->storage->releaseLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
|
|
Loading…
Reference in New Issue