Skip to contentSkip to conversation

xenbus: add missing wakeup in concurrent read/write

PATCH In review Daniel De Graaf 3 participants 3 messages Sep 7, 2010 – Sep 8, 2010 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xenbus: add missing wakeup in concurrent read/write

If an application has a dedicated read thread watching xenbus and another thread writes an XS_WATCH message that generates a synthetic "OK" reply, this reply will be enqueued in the buffer without waking up the reader. This can cause a deadlock in the application if it then waits for the read thread to receive the queued message.

commit e752969f502a511e83f841aa01d6cd332e6d85a0

Author: Daniel De Graaf <[email protected]>
Date:   Tue Sep 7 11:21:52 2010 -0400

xenbus: fix deadlock in concurrent read/write

If an application has a dedicated read thread watching xenbus and another thread writes an XS_WATCH message that generates a synthetic "OK" reply, this reply will be enqueued in the buffer without waking up the reader.

drivers/xen/xenfs/xenbus.c +1 -0
index c309f1f..6665ded 100644
@@ -406,6 +406,7 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
 
 		mutex_lock(&u->reply_mutex);
 		rc = queue_reply(&u->read_buffers, &reply, sizeof(reply));
+		wake_up(&u->read_waitq);
 		mutex_unlock(&u->reply_mutex);
 	}
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 7 lines · Daniel De Graaf

If an application has a dedicated read thread watching xenbus and another thread writes an XS_WATCH message that generates a synthetic "OK" reply, this reply will be enqueued in the buffer without waking up the reader. This can cause a deadlock in the application if it then waits for the read thread to receive the queued message.

Thanks. Jun Zhu, does this fix the problem you were reporting?

J

#2 lore raw

That's right! Thanks.

Jun Zhu
Citrix Systems UK
________________________________________
From: Jeremy Fitzhardinge [[email protected]]
Sent: 07 September 2010 19:34
To: Daniel De Graaf
Cc: xen-devel; Jun Zhu (Intern)
Subject: Re: [Xen-devel] [PATCH] xenbus: add missing wakeup in concurrent read/write

Quoted 7 lines · Daniel De Graaf

If an application has a dedicated read thread watching xenbus and another thread writes an XS_WATCH message that generates a synthetic "OK" reply, this reply will be enqueued in the buffer without waking up the reader. This can cause a deadlock in the application if it then waits for the read thread to receive the queued message.

Thanks. Jun Zhu, does this fix the problem you were reporting?

J