[libvirt] [PATCH v4 11/23] lock_driver: Introduce VIR_LOCK_MANAGER_ACQUIRE_ROLLBACK

John Ferlan jferlan at redhat.com
Mon Sep 17 21:04:25 UTC 2018


[...]

>>   cleanup:
>> -    if (rv != 0 && fd)
>> -        VIR_FORCE_CLOSE(*fd);
>> +    if (rv < 0) {
>> +        int saved_errno = errno;
>> +        virErrorPtr origerr;
>> +
>> +        virErrorPreserveLast(&origerr);
>> +        if (fd)
>> +            VIR_FORCE_CLOSE(*fd);
>> +
>> +        if (client && program &&
>> +            flags & VIR_LOCK_MANAGER_ACQUIRE_ROLLBACK &&
>> +            !(flags & VIR_LOCK_MANAGER_ACQUIRE_REGISTER_ONLY)) {
> 
> Not sure any of the above 3 mean anything since lastGood is only set > 0
> in one place so I would think the subsequent loop is good alone. I
> haven't looked ahead though ;-)
> 
>> +            for (i = lastGood; i >= 0; i--) {

BTW: It just dawned on me while looking at patch 16 - this loop goes
backwards and the ReleaseImpl call was *incrementing* counter.  I wonder
if that's what Bjoern ran into during testing. Even more reason to not
pass &counter!

John

>> +                virLockManagerLockDaemonResourcePtr res = &priv->resources[i];
>> +
>> +                if (virLockManagerLockDaemonReleaseImpl(client, program,
>> +                                                        &counter, res) < 0)
>> +                    VIR_WARN("Unable to release resource lockspace=%s name=%s",
>> +                             res->lockspace, res->name);
>> +            }
>> +        }
>> +
>> +        virErrorRestore(&origerr);
>> +        errno = saved_errno;
>> +    }





More information about the libvir-list mailing list