« Previous | Next » 

Revision e4e35357

IDe4e353579c973418be791fc2acac1fb64ba80f40

Added by Michael Hanselmann about 13 years ago

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 <>
Reviewed-by: Iustin Pop <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences