From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerd Knorr Subject: [patch] fix xenbus race Date: Mon, 31 Oct 2005 15:16:05 +0100 Message-ID: <43662725.5030608@suse.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010707000503020308060908" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------010707000503020308060908 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, Watch events may get lost, the xenstored response races against the new watch being added to the watch list in register_xenbus_watch(). Fixed by adding the watch to the list unconditionally, and remove it in the error case. That one fixes the network issues I'm seeing. Due to the race the "online" hotplug event for the vif backend was lost sometimes. please apply, Gerd --------------010707000503020308060908 Content-Type: text/x-patch; name="xenbus-race.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xenbus-race.diff" diff -r 43676a509982 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c Sun Oct 30 18:23:36 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c Mon Oct 31 15:08:14 2005 @@ -682,14 +682,15 @@ spin_lock(&watches_lock); BUG_ON(find_watch(token)); + list_add(&watch->list, &watches); spin_unlock(&watches_lock); err = xs_watch(watch->node, token); /* Ignore errors due to multiple registration. */ - if ((err == 0) || (err == -EEXIST)) { + if ((err != 0) && (err != -EEXIST)) { spin_lock(&watches_lock); - list_add(&watch->list, &watches); + list_del(&watch->list); spin_unlock(&watches_lock); } --------------010707000503020308060908 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------010707000503020308060908--