]> xenbits.xen.org Git - xenclient/linux-2.6.27-pq.git/commitdiff
Add an argument to v2v_accept, to have a non blocking version.
authorJean Guyader <jean.guyader@eu.citrix.com>
Wed, 4 Nov 2009 05:25:56 +0000 (05:25 +0000)
committerJean Guyader <jean.guyader@eu.citrix.com>
Wed, 4 Nov 2009 05:28:46 +0000 (05:28 +0000)
master/series
master/v2v-accept-nonblock [new file with mode: 0644]

index 9d164ddd59dd0b4003a6036b4e0941409b3ca843..33a4d809a9bd176750196d7a9776dcb0e30aede8 100644 (file)
@@ -355,3 +355,4 @@ bsg-add-global-sgio-mutex.patch
 itpm
 v2v-core
 v2v-async
+v2v-accept-nonblock
diff --git a/master/v2v-accept-nonblock b/master/v2v-accept-nonblock
new file mode 100644 (file)
index 0000000..6de0e49
--- /dev/null
@@ -0,0 +1,65 @@
+diff --git a/drivers/xen/v2v/v2v.c b/drivers/xen/v2v/v2v.c
+index 57d51be..304f421 100644
+--- a/drivers/xen/v2v/v2v.c
++++ b/drivers/xen/v2v/v2v.c
+@@ -792,7 +792,7 @@ v2v_get_remote_state(struct v2v_channel *channel, enum v2v_endpoint_state *state
+ EXPORT_SYMBOL_GPL(v2v_get_remote_state);
+ int
+-v2v_accept(struct v2v_channel *channel)
++v2v_accept(struct v2v_channel *channel, int nonblock)
+ {
+     int err = 0;
+     struct xenbus_transaction xbt = {0};
+@@ -807,8 +807,9 @@ v2v_accept(struct v2v_channel *channel)
+         case v2v_state_disconnected:
+         case v2v_state_crashed:
+             xenbus_transaction_end(xbt, 1);
+-            wait_event(channel->wait_state.wait_event,
+-                       atomic_xchg(&channel->wait_state.wait_condition, 0) == 1);
++            if (!noblock)
++                wait_event(channel->wait_state.wait_event,
++                        atomic_xchg(&channel->wait_state.wait_condition, 0) == 1);
+             /* ### get the event reason, should be only the control event right now */
+             reason = v2v_wrq_dequeue(channel, V2V_WAKE_REASON_ANY);
+             if (reason != V2V_WAKE_REASON_CONTROL) {
+@@ -842,6 +843,8 @@ v2v_accept(struct v2v_channel *channel)
+                 EPRINTK("v2v_accept - error commiting xs transaction - err: %d\n", err);
+                 return err;
+             }
++            if (noblock)
++                return -EAGAIN;
+             break; /* try again */                     
+         }          
+     }
+diff --git a/drivers/xen/v2v/v2vops.c b/drivers/xen/v2v/v2vops.c
+index 83854a2..66bfe93 100644
+--- a/drivers/xen/v2v/v2vops.c
++++ b/drivers/xen/v2v/v2vops.c
+@@ -752,7 +752,7 @@ v2vdrv_listen_accept(struct v2vdrv_context *ctx)
+     printk("%s listener(%p) listener started, wait to accept...\n", V2VDRV_LOGTAG, ctx);
+     
+     /* Wait to accept the connection from the connector end */
+-    err = v2v_accept(ctx->channel);
++    err = v2v_accept(ctx->channel, 0);
+     if (err) {
+         if (err != -ENOLINK)
+             printk("%s listener(%p) failure in v2v_accept() - error: %d\n", V2VDRV_LOGTAG, ctx, err);
+diff --git a/include/xen/v2v.h b/include/xen/v2v.h
+index 5233f80..8542037 100644
+--- a/include/xen/v2v.h
++++ b/include/xen/v2v.h
+@@ -118,10 +118,12 @@ int v2v_listen(const char *xenbus_prefix,
+ /* Wait for a remote domain to connect to the channel @channel, which
+  * should have been allocated with v2v_listen().
++ * @nonblock, doesn't wait if set, return EAGAIN if the connector is
++ * not ready.
+  *
+  * Returns 0 on success and an appropriate errno code on failure.
+  */
+-int v2v_accept(struct v2v_channel *channel);
++int v2v_accept(struct v2v_channel *channel, int nonblock);
+ /* Connect to a VM-to-VM channel specified by @xenbus_prefix, which
+  * should previously have been initialised by the tools, and place the