]> xenbits.xensource.com Git - qemu-xen-4.3-testing.git/commitdiff
xs_rm xenstore command from xend after we read it
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 18 Jun 2009 13:53:58 +0000 (14:53 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 18 Jun 2009 13:53:58 +0000 (14:53 +0100)
in xenstore_process_dm_command_event(), xs_rm the
command node after we read it.

As Ian Jackson pointed out: "when we start processing a command we
should delete it from xenstore immediately, so that future watch
triggerings either don't see the command or actually see genuine new
invocations".

The patch is used to overcome a race condition that occurs after
changeset 19679: ec2bc4b9fa32 (xend: hot-plug PCI devices at
boot-time) and could break the device assignment of hvm guest:

ioemu's xs_watch() fires the 'command' for the 1st time and xend's
signalDeviceModel('pci-ins',...) fires it for the 2nd time -- without
the patch, the 2nd time watch handling would try to invoke
xenstore_process_dm_command_event() again and since the 'parameter'
node has been changed to hold vslot by ioemu, the second time would
fail and set 'parameter' to "no free hotplug slots" at the end of the
2nd handling; and, if xend runs slower, xend would treat the
'parameter' of the 2nd time as that of the 1st time and destroy the
guest.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
xenstore.c

index d2f38d2e7aaa855a2c08a25417204d94f5f9ff8d..0618c80626d441abf5e9fbd43cc9055fe18bc62d 100644 (file)
@@ -756,6 +756,9 @@ static void xenstore_process_dm_command_event(void)
     if (!command)
         goto out;
     
+    if (!xs_rm(xsh, XBT_NULL, path))
+        fprintf(logfile, "xs_rm failed: path=%s\n", path);
+
     if (!strncmp(command, "save", len)) {
         fprintf(logfile, "dm-command: pause and save state\n");
         xen_pause_requested = 1;