[...]
> 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;
> + }