On 7/19/19 5:19 AM, Wang Yechao wrote:
> virCgroupRemove return -1 when removing cgroup failed.
> But there are retry code to remove cgroup in QemuProcessStop:
>
> retry:
> if ((ret = qemuRemoveCgroup(vm)) < 0) {
> if (ret == -EBUSY && (retries++ < 5)) {
> usleep(200*1000);
> goto retry;
> }
> VIR_WARN("Failed to remove cgroup for %s",
> vm->def->name);
> }
>
> The return value of qemuRemoveCgroup will never be equal to "-EBUSY",
> so change the return value of virCgroupRemove if failed.
>
> Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
> ---
> src/util/vircgroup.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
> index 268e401..260ed2d 100644
> --- a/src/util/vircgroup.c
> +++ b/src/util/vircgroup.c
> @@ -2399,11 +2399,13 @@ int
> virCgroupRemove(virCgroupPtr group)
> {
> size_t i;
> + int ret = 0;
>
> for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
> - if (group->backends[i] &&
> - group->backends[i]->remove(group) < 0) {
> - return -1;
> + if (group->backends[i])
> + ret = group->backends[i]->remove(group);
> + if (ret < 0)
> + return ret;
> }
> }
>
>
Ah, good catch. I'm fixin the missig curly brace, moving the @ret
definition inside the if() and renaming it to rc.
ACKed and pushed.
Michal
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list