All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Knorr <kraxel@suse.de>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [patch] fix xenbus race
Date: Mon, 31 Oct 2005 15:16:05 +0100	[thread overview]
Message-ID: <43662725.5030608@suse.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

   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

[-- Attachment #2: xenbus-race.diff --]
[-- Type: text/x-patch, Size: 690 bytes --]

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);
 	}
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2005-10-31 14:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-31 14:16 Gerd Knorr [this message]
2005-10-31 15:25 ` [patch] fix xenbus race Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43662725.5030608@suse.de \
    --to=kraxel@suse.de \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.