locking: Fix race condition in lock monitor
In some rare cases it can happen that a lock is re-created very soon after deletion, while the old instance hasn't been destructed yet. In such a case the code would detect a duplicate name and raise an exception. We have seen at least one case where this happened during the creation of many instances. It is not exactly clear how it came to be, but it appears to have occurred while different jobs fought for locks with short timeouts (in the case of instance creation locks are added at this stage and removed shortly after if not all locks can be acquired). The issue is fixed by removing the check for duplicate names. To still guarantee a stable sort order for the lock information as shown by “gnt-debug locks”, a registration number is recorded for each lock in the monitor. A unittest is included to check for the situation. Signed-off-by:Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
Loading
Please register or sign in to comment