[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 2/3] libxc: adjust retry loop in xc_cpupool_removecpu()



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@xxxxxxxxxxxxx>
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/libxc/xc_cpupool.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/libxc/xc_cpupool.c b/tools/libxc/xc_cpupool.c
index 261b9c9..bb99e3b 100644
--- a/tools/libxc/xc_cpupool.c
+++ b/tools/libxc/xc_cpupool.c
@@ -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;
-- 
2.6.6


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.