From 51f5edd7498333f1f6356fbfd90578db4875cf83 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 22 Apr 2016 16:07:08 +0200 Subject: [PATCH] add locks in the scanner to prevent multiple scanners running on the same files --- lib/private/files/cache/scanner.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index 8730707f1c..feefe29d27 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -296,6 +296,7 @@ class Scanner extends BasicEmitter implements IScanner { } if ($lock) { if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { + $this->storage->acquireLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); $this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); } } @@ -307,6 +308,7 @@ class Scanner extends BasicEmitter implements IScanner { 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;