Revision ea3f80bf lib/locking.py

b/lib/locking.py
413 413
      for (lname, lock) in acquire_list:
414 414
        try:
415 415
          lock.acquire(shared=shared) # raises LockError if the lock is deleted
416
          try:
417
            # now the lock cannot be deleted, we have it!
418
            self._add_owned(lname)
419
            acquired.add(lname)
420
          except:
421
            # We shouldn't have problems adding the lock to the owners list, but
422
            # if we did we'll try to release this lock and re-raise exception.
423
            # Of course something is going to be really wrong, after this.
424
            lock.release()
425
            raise
426

  
416
          # now the lock cannot be deleted, we have it!
417
          self._add_owned(lname)
418
          acquired.add(lname)
427 419
        except (errors.LockError):
428 420
          if self.__lock._is_owned():
429 421
            # We are acquiring all the set, it doesn't matter if this particular
......
435 427
              self.__lockdict[lname].release()
436 428
              self._del_owned(lname)
437 429
            raise errors.LockError('non-existing lock in set (%s)' % name_fail)
430
        except:
431
          # We shouldn't have problems adding the lock to the owners list, but
432
          # if we did we'll try to release this lock and re-raise exception.
433
          # Of course something is going to be really wrong, after this.
434
          if lock._is_owned():
435
            lock.release()
436
            raise
438 437

  
439 438
    except:
440 439
      # If something went wrong and we had the set-lock let's release it...

Also available in: Unified diff