[libvirt] [PATCH v4 16/23] security_manager: Introduce metadata locking APIs
Michal Privoznik
mprivozn at redhat.com
Mon Sep 10 13:53:16 UTC 2018
On 09/10/2018 02:19 PM, Bjoern Walk wrote:
> Michal Privoznik <mprivozn at redhat.com> [2018-09-10, 11:36AM +0200]:
>> +int
>> +virSecurityManagerMetadataLock(virSecurityManagerPtr mgr,
>> + const char * const *paths,
>> + size_t npaths)
>> +{
>> + virLockManagerPtr lock;
>> + virTimeBackOffVar timebackoff;
>> + int fd = -1;
>> + int rv;
>
> gcc complains that rv might be uninitialized.
Right, if ..
>
>> + int ret = -1;
>> +
>> + virMutexLock(&lockManagerMutex);
>> +
>> + if (!(lock = virSecurityManagerNewLockManager(mgr, paths, npaths)))
>> + goto cleanup;
>> +
>> + if (virTimeBackOffStart(&timebackoff, 1, LOCK_ACQUIRE_TIMEOUT * 1000) < 0)
>> + goto cleanup;
>> + while (virTimeBackOffWait(&timebackoff)) {
.. this is never true (which is impossible).
>> + rv = virLockManagerAcquire(lock, NULL,
>> + VIR_LOCK_MANAGER_ACQUIRE_ROLLBACK,
>> + VIR_DOMAIN_LOCK_FAILURE_DEFAULT, &fd);
>> +
>> + if (rv >= 0)
>> + break;
>> +
>> + if (virGetLastErrorCode() == VIR_ERR_RESOURCE_BUSY)
>> + continue;
>> +
>> + goto cleanup;
>> + }
>> +
>> + if (rv < 0)
>> + goto cleanup;
Okay, I'll fix this is my local branch.
Thanks,
Michal
More information about the libvir-list
mailing list