summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2016-04-22 16:07:08 +0200
committerRobin Appelman <icewind@owncloud.com>2016-04-25 18:25:54 +0200
commitc58f16899b941c12d085d2d68c00e8bc5936eba9 (patch)
treed0ed1fe3d734a39268c2cbff02d6a8e1ac6a27e2
parent6c0d61c9a8aebf60781ceb489c4902b387fcd3ac (diff)
downloadnextcloud-server-c58f16899b941c12d085d2d68c00e8bc5936eba9.tar.gz
nextcloud-server-c58f16899b941c12d085d2d68c00e8bc5936eba9.zip
add locks in the scanner to prevent multiple scanners running on the same files
-rw-r--r--lib/private/files/cache/scanner.php2
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;
}