From fd8e3f730169ef97de98578b5b7aa726951a424e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 22 Apr 2016 16:07:08 +0200 Subject: 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 b0890dcdc00..db32c0b82eb 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -261,6 +261,7 @@ class Scanner extends BasicEmitter { $reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG; } if ($lock) { + $this->storage->acquireLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); $this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); } $data = $this->scanFile($path, $reuse, -1, null, $lock); @@ -270,6 +271,7 @@ class Scanner extends BasicEmitter { } if ($lock) { $this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); + $this->storage->releaseLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); } return $data; } -- cgit v1.2.3