diff options
author | Robin Appelman <icewind@owncloud.com> | 2016-04-22 16:07:08 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2016-04-25 15:48:03 +0200 |
commit | fd8e3f730169ef97de98578b5b7aa726951a424e (patch) | |
tree | 3323b06e467f1214f8c954abecd22e15cfd92ecb | |
parent | 505e2b35b05856613a422ce2cb3b8cd3cf70de93 (diff) | |
download | nextcloud-server-fd8e3f730169ef97de98578b5b7aa726951a424e.tar.gz nextcloud-server-fd8e3f730169ef97de98578b5b7aa726951a424e.zip |
add locks in the scanner to prevent multiple scanners running on the same files
-rw-r--r-- | lib/private/files/cache/scanner.php | 2 |
1 files changed, 2 insertions, 0 deletions
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; } |