]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
libxc: cpupools: adjust retry loop in xc_cpupool_removecpu()
authorJuergen Gross <jgross@suse.com>
Fri, 15 Apr 2016 14:54:16 +0000 (16:54 +0200)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 20 Apr 2016 13:44:01 +0000 (14:44 +0100)
Commit 1ef6beea187b ("libxc: do some retries in xc_cpupool_removecpu()
for EBUSY case") added a retry loop in xc_cpupool_removecpu() for the
EBUSY case. As EBUSY was returned in multiple error situations the
loop would have been executed in situations where a retry would not
be successful. Additionally calling sleep(1) between the rerires is a
bad idea when being called in a daemon.

The hypervisor has been changed to return different error values now.
The retry added in above mentioned commit should be done in the
EADDRINUSE case now. As the error condition should last only for a
very short time, the sleep(1) call can be removed.

Requested-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Alan Robinson <alan.robinson@ts.fujitsu.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxc/xc_cpupool.c

index 261b9c956ef5ff6f563ca3efd8d09dc1728efe76..bb99e3bed3e7ae90501c6e8e140922f33b65bb33 100644 (file)
@@ -139,7 +139,7 @@ int xc_cpupool_addcpu(xc_interface *xch,
 }
 
 /*
- * The hypervisor might return EBUSY when trying to remove a cpu from a
+ * The hypervisor might return EADDRINUSE when trying to remove a cpu from a
  * cpupool when a domain running in this cpupool has pinned a vcpu
  * temporarily. Do some retries in this case, perhaps the situation
  * cleans up.
@@ -160,9 +160,7 @@ int xc_cpupool_removecpu(xc_interface *xch,
     sysctl.u.cpupool_op.cpu = (cpu < 0) ? XEN_SYSCTL_CPUPOOL_PAR_ANY : cpu;
     for ( retries = 0; retries < NUM_RMCPU_BUSY_RETRIES; retries++ ) {
         err = do_sysctl_save(xch, &sysctl);
-        if ( err < 0 && errno == EBUSY )
-            sleep(1);
-        else
+        if ( err == 0 || errno != EADDRINUSE )
             break;
     }
     return err;