fix xenbus race
PATCH 1/1 fix xenbus race
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
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +3 -2
@@ -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); }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines · Gerd Knorr
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,
Thanks. That's an embarrassing race introduced by me. :-(
-- Keir