[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Clean up use of wait_event_interruptible().



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 990b436099befd67d3fec6dfe704e2022c20924d
# Parent  8f1f6c70e4f5f29cc7df518e4d547cf3ccec2ab9
Clean up use of wait_event_interruptible().

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 8f1f6c70e4f5 -r 990b436099be 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Thu Mar  2 
15:41:45 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Thu Mar  2 
17:57:03 2006
@@ -89,14 +89,18 @@
 {
        struct xenstore_domain_interface *intf = xenstore_domain_interface();
        XENSTORE_RING_IDX cons, prod;
+       int rc;
 
        while (len != 0) {
                void *dst;
                unsigned int avail;
 
-               wait_event_interruptible(xb_waitq,
-                                        (intf->req_prod - intf->req_cons) !=
-                                        XENSTORE_RING_SIZE);
+               rc = wait_event_interruptible(
+                       xb_waitq,
+                       (intf->req_prod - intf->req_cons) !=
+                       XENSTORE_RING_SIZE);
+               if (rc < 0)
+                       return rc;
 
                /* Read indexes, then verify. */
                cons = intf->req_cons;
@@ -130,13 +134,17 @@
 {
        struct xenstore_domain_interface *intf = xenstore_domain_interface();
        XENSTORE_RING_IDX cons, prod;
+       int rc;
 
        while (len != 0) {
                unsigned int avail;
                const char *src;
 
-               wait_event_interruptible(xb_waitq,
-                                        intf->rsp_cons != intf->rsp_prod);
+               rc = wait_event_interruptible(
+                       xb_waitq,
+                       intf->rsp_cons != intf->rsp_prod);
+               if (rc < 0)
+                       return rc;
 
                /* Read indexes, then verify. */
                cons = intf->rsp_cons;
diff -r 8f1f6c70e4f5 -r 990b436099be 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Thu Mar  2 
15:41:45 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Thu Mar  2 
17:57:03 2006
@@ -123,8 +123,9 @@
 
        while (list_empty(&xs_state.reply_list)) {
                spin_unlock(&xs_state.reply_lock);
-               wait_event_interruptible(xs_state.reply_waitq,
-                                        !list_empty(&xs_state.reply_list));
+               /* XXX FIXME: Avoid synchronous wait for response here. */
+               wait_event(xs_state.reply_waitq,
+                          !list_empty(&xs_state.reply_list));
                spin_lock(&xs_state.reply_lock);
        }
 
@@ -685,6 +686,9 @@
                wait_event_interruptible(watch_events_waitq,
                                         !list_empty(&watch_events));
 
+               if (kthread_should_stop())
+                       break;
+
                down(&xenwatch_mutex);
 
                spin_lock(&watch_events_lock);
@@ -705,6 +709,8 @@
 
                up(&xenwatch_mutex);
        }
+
+       return 0;
 }
 
 static int process_msg(void)
@@ -778,7 +784,11 @@
                if (err)
                        printk(KERN_WARNING "XENBUS error %d while reading "
                               "message\n", err);
-       }
+               if (kthread_should_stop())
+                       break;
+       }
+
+       return 0;
 }
 
 int xs_init(void)

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.