diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-06-03 16:44:57 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-06-15 14:32:29 +0200 |
commit | 7d72f7d8ce3c15e25382c6121c374de92fe84775 (patch) | |
tree | 9f3fc7f5a73b63183eb62643ec8b7f2cb424b8e3 /lib/private/files/view.php | |
parent | 5eb0dace8c680425165e36c0b6d64d0245841c3a (diff) | |
download | nextcloud-server-7d72f7d8ce3c15e25382c6121c374de92fe84775.tar.gz nextcloud-server-7d72f7d8ce3c15e25382c6121c374de92fe84775.zip |
keep a read lock while scanning a file or folder
Diffstat (limited to 'lib/private/files/view.php')
-rw-r--r-- | lib/private/files/view.php | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 99db05f65c2..f410fdc8c00 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -771,9 +771,12 @@ class View { } else { $result = $storage2->copyFromStorage($storage1, $internalPath1, $internalPath2); } + + $this->changeLock($path2, ILockingProvider::LOCK_SHARED); + $this->updater->update($path2); - $this->unlockFile($path2, ILockingProvider::LOCK_EXCLUSIVE); + $this->unlockFile($path2, ILockingProvider::LOCK_SHARED); $this->unlockFile($path1, ILockingProvider::LOCK_SHARED); if ($this->shouldEmitHooks() && $result !== false) { @@ -996,6 +999,10 @@ class View { throw $e; } + if ((in_array('write', $hooks) || in_array('delete', $hooks)) && $operation !== 'fopen') { + $this->changeLock($path, ILockingProvider::LOCK_SHARED); + } + if (in_array('delete', $hooks) and $result) { $this->updater->remove($path); } @@ -1014,12 +1021,8 @@ class View { $this->unlockFile($path, ILockingProvider::LOCK_SHARED); } }); - } else { - if (in_array('write', $hooks) || in_array('delete', $hooks)) { - $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); - } else if (in_array('read', $hooks)) { - $this->unlockFile($path, ILockingProvider::LOCK_SHARED); - } + } else if (in_array('write', $hooks) || in_array('delete', $hooks) || in_array('read', $hooks)) { + $this->unlockFile($path, ILockingProvider::LOCK_SHARED); } |