Michal Privoznik <mprivozn(a)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.
+ 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)) {
+ 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;
+
+ mgr->fd = fd;
+ fd = -1;
+
+ ret = 0;
+ cleanup:
+ virLockManagerFree(lock);
+ VIR_FORCE_CLOSE(fd);
+ if (ret < 0)
+ virMutexUnlock(&lockManagerMutex);
+ return ret;
+}
--
IBM Systems
Linux on Z & Virtualization Development
------------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Schönaicher Str. 220, 71032 Böblingen
Phone: +49 7031 16 1819
------------------------------------------------------------------------
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294