diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-05-23 20:05:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-23 20:05:01 +0200 |
commit | 6b6d522969c6f7613c8f897517d172de3d9646a4 (patch) | |
tree | 9db045fa48905cef719017e8452b5eb76e8cec1c | |
parent | 3a41db7f67f5f22dacb1b2ffee7f8d86c04900ac (diff) | |
parent | 63caf331e500173ba59957545274460362beea9b (diff) | |
download | nextcloud-server-6b6d522969c6f7613c8f897517d172de3d9646a4.tar.gz nextcloud-server-6b6d522969c6f7613c8f897517d172de3d9646a4.zip |
Merge pull request #9395 from nextcloud/scanner-error-lock-cleanup
cleanup locks in scanner on error
-rw-r--r-- | lib/private/Files/Cache/Scanner.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index e148a25accd..ca9a0b794f9 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -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; |