mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-15 00:21:56 +00:00
fix locking, partial fix for #502
the problem was that the borg process removed its own shared lock when upgrading it to an exclusive lock. this is fine if we get the exclusive lock, but if we don't, we must re-add our shared lock. this fixes the KeyError in locking.py:217
This commit is contained in:
parent
f35ba0b577
commit
845d2144cb
1 changed files with 3 additions and 1 deletions
|
@ -278,9 +278,11 @@ class UpgradableLock:
|
||||||
try:
|
try:
|
||||||
if remove is not None:
|
if remove is not None:
|
||||||
self._roster.modify(remove, REMOVE)
|
self._roster.modify(remove, REMOVE)
|
||||||
remove = None
|
|
||||||
if len(self._roster.get(SHARED)) == 0:
|
if len(self._roster.get(SHARED)) == 0:
|
||||||
return # we are the only one and we keep the lock!
|
return # we are the only one and we keep the lock!
|
||||||
|
# restore the roster state as before (undo the roster change):
|
||||||
|
if remove is not None:
|
||||||
|
self._roster.modify(remove, ADD)
|
||||||
except:
|
except:
|
||||||
# avoid orphan lock when an exception happens here, e.g. Ctrl-C!
|
# avoid orphan lock when an exception happens here, e.g. Ctrl-C!
|
||||||
self._lock.release()
|
self._lock.release()
|
||||||
|
|
Loading…
Add table
Reference in a new issue