File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
apps/dav/lib/Connector/Sabre Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,23 @@ public function put($data) {
173173 [$ storage , $ internalPath ] = $ this ->fileView ->resolvePath ($ this ->path );
174174 try {
175175 if (!$ needsPartFile ) {
176- $ this ->changeLock (ILockingProvider::LOCK_EXCLUSIVE );
176+ try {
177+ $ this ->changeLock (ILockingProvider::LOCK_EXCLUSIVE );
178+ } catch (LockedException $ e ) {
179+ // during very large uploads, the shared lock we got at the start might have been expired
180+ // meaning that the above lock can fail not just only because somebody else got a shared lock
181+ // or because there is no existing shared lock to make exclusive
182+ //
183+ // Thus we try to get a new exclusive lock, if the original lock failed because of a different shared
184+ // lock this will still fail, if our original shared lock expired the new lock will be successful and
185+ // the entire operation will be safe
186+
187+ try {
188+ $ this ->acquireLock (ILockingProvider::LOCK_EXCLUSIVE );
189+ } catch (LockedException $ ex ) {
190+ throw new FileLocked ($ e ->getMessage (), $ e ->getCode (), $ e );
191+ }
192+ }
177193 }
178194
179195 if (!is_resource ($ data )) {
You can’t perform that action at this time.
0 commit comments