WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH][ioemu] in xenstore_process_dm_command_event(), xs_rm

To: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH][ioemu] in xenstore_process_dm_command_event(), xs_rm the command node after we read it.
From: "Cui, Dexuan" <dexuan.cui@xxxxxxxxx>
Date: Wed, 17 Jun 2009 02:28:05 +0800
Accept-language: zh-CN, en-US
Acceptlanguage: zh-CN, en-US
Cc: Keir, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Fraser <Keir.Fraser@xxxxxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxxxx>
Delivery-date: Tue, 16 Jun 2009 11:29:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <EADF0A36011179459010BDF5142A457501C9D98D07@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <EADF0A36011179459010BDF5142A457501C9D98D00@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <18999.54551.711286.625101@xxxxxxxxxxxxxxxxxxxxxxxx> <EADF0A36011179459010BDF5142A457501C9D98D07@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcnupzU4ux09YkYHSUe5B37233/GdAAARZTgAAEqbdA=
Thread-topic: [PATCH][ioemu] 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@xxxxxxxxx>

diff --git a/xenstore.c b/xenstore.c
index d2f38d2..0618c80 100644
--- a/xenstore.c
+++ b/xenstore.c
@@ -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;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel