All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xenbus: add missing wakeup in concurrent read/write
@ 2010-09-07 15:42 Daniel De Graaf
  2010-09-07 23:34 ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel De Graaf @ 2010-09-07 15:42 UTC (permalink / raw)
  To: xen-devel

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

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.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>


[-- Attachment #2: xenbus-rw-deadlock.patch --]
[-- Type: text/plain, Size: 848 bytes --]

commit e752969f502a511e83f841aa01d6cd332e6d85a0
Author: Daniel De Graaf <dgdegra@tycho.nsa.gov>
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.

diff --git a/drivers/xen/xenfs/xenbus.c b/drivers/xen/xenfs/xenbus.c
index c309f1f..6665ded 100644
--- a/drivers/xen/xenfs/xenbus.c
+++ b/drivers/xen/xenfs/xenbus.c
@@ -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);
 	}
 

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

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xenbus: add missing wakeup in concurrent read/write
  2010-09-07 15:42 [PATCH] xenbus: add missing wakeup in concurrent read/write Daniel De Graaf
@ 2010-09-07 23:34 ` Jeremy Fitzhardinge
  2010-09-08 10:51   ` Jun Zhu (Intern)
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Fitzhardinge @ 2010-09-07 23:34 UTC (permalink / raw)
  To: Daniel De Graaf; +Cc: Jun Zhu (Intern), xen-devel

 On 09/08/2010 01:42 AM, Daniel De Graaf wrote:
> 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.
>
> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>

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

    J

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] xenbus: add missing wakeup in concurrent read/write
  2010-09-07 23:34 ` Jeremy Fitzhardinge
@ 2010-09-08 10:51   ` Jun Zhu (Intern)
  0 siblings, 0 replies; 3+ messages in thread
From: Jun Zhu (Intern) @ 2010-09-08 10:51 UTC (permalink / raw)
  To: Jeremy Fitzhardinge, Daniel De Graaf; +Cc: xen-devel

That's right!  Thanks.

Jun Zhu
Citrix Systems UK
________________________________________
From: Jeremy Fitzhardinge [jeremy@goop.org]
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

 On 09/08/2010 01:42 AM, Daniel De Graaf wrote:
> 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.
>
> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>

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

    J

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-08 10:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-07 15:42 [PATCH] xenbus: add missing wakeup in concurrent read/write Daniel De Graaf
2010-09-07 23:34 ` Jeremy Fitzhardinge
2010-09-08 10:51   ` Jun Zhu (Intern)

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.