diff options
author | Robin Appelman <icewind@owncloud.com> | 2016-04-22 16:07:08 +0200 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-04-25 11:09:08 +0200 |
commit | 4ac16001e024c869420a5d9775f3b5bb162311c4 (patch) | |
tree | 040ac6507ba9d9621a1b7cb0a2c6054b119280e5 /lib/private/Files | |
parent | 74de72e75e68cb3aaffa2ab90fbd685e755b4262 (diff) | |
download | nextcloud-server-4ac16001e024c869420a5d9775f3b5bb162311c4.tar.gz nextcloud-server-4ac16001e024c869420a5d9775f3b5bb162311c4.zip |
add locks in the scanner to prevent multiple scanners running on the same files
Diffstat (limited to 'lib/private/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 8730707f1c2..feefe29d276 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; |