Fix releasing a shared lock multiple times#21074
Fix releasing a shared lock multiple times#21074MorrisJobke merged 2 commits intonextcloud:masterfrom
Conversation
b2f4e92 to
cf05823
Compare
|
Thanks for your patch 🎉 If the LockPlugin already obtains the lock why not remove the shared lock in createFile? 🤔 |
Thanks for the quick response! In my debug session, I found that Since it's a PUT request for a new file, perhaps it makes some sense that initially the |
That makes sense. So it's maybe enough to remove the lock release from createFile? But making the locking provider more stable is also a good thing. I'm just trying to understand why a code path runs twice. |
In the current code I like that it's clear what part is responsible for releasing each lock - it's literally all in the same file/function. If I find it a bit confusing that It seems a bit scary to me that if |
Signed-off-by: Jaakko Salo <jaakkos@gmail.com>
ce3adb1 to
a279736
Compare
When uploading new files, getNodeForPath() will not succeed yet so the lock cannot be acquired. In that case, don't try to unlock it either. Signed-off-by: Jaakko Salo <jaakkos@gmail.com>
a279736 to
6886b46
Compare
|
Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 |
|
/backport to stable19 |
|
/backport to stable18 |
|
/backport to stable17 |
|
I closed the ones to 17 and 18, because they do not apply clean. |
This patch makes
MemcacheLockingProviderhandle multiple releases of the same shared lock gracefully.Previously, the lock will get negative values that cause problems as seen in #21073
During PUT requests,
server/apps/dav/lib/Connector/Sabre/Directory.php
Line 157 in 5e35594
server/apps/dav/lib/Connector/Sabre/LockPlugin.php
Line 83 in 5e35594
LockPluginnever acquired the lock.MemcacheLockingProvideralready had some logic to handle multiple releases (negative going lock values), but it was subject to a race condition.