]> xenbits.xen.org Git - xenclient/linux-2.6.27-pq.git/commitdiff
Fixed missing grant ref teardown in disconnect supplicant routine.
authorRoss Philipson <ross.philipson@citrix.com>
Sat, 7 Nov 2009 16:35:56 +0000 (11:35 -0500)
committerRoss Philipson <ross.philipson@citrix.com>
Sat, 7 Nov 2009 16:35:56 +0000 (11:35 -0500)
 Changes to be committed:
modified:   master/series
new file:   master/v2v-fix-disconnect

master/series
master/v2v-fix-disconnect [new file with mode: 0644]

index fe0cb9d32432a43c4e240ba257e8aec807d62ac7..cadd92e56ffa1d6fe8764da858bb6583b714362b 100644 (file)
@@ -357,3 +357,4 @@ v2v-core
 v2v-async
 v2v-accept-nonblock
 v2v-dev
+v2v-fix-disconnect
diff --git a/master/v2v-fix-disconnect b/master/v2v-fix-disconnect
new file mode 100644 (file)
index 0000000..ddef288
--- /dev/null
@@ -0,0 +1,40 @@
+diff --git a/drivers/xen/v2v/v2v.c b/drivers/xen/v2v/v2v.c
+index 1bcab10..c79a2ed 100644
+--- a/drivers/xen/v2v/v2v.c
++++ b/drivers/xen/v2v/v2v.c
+@@ -1253,7 +1253,26 @@ v2v_disconnect_supplicant(const struct v2v_channel *_channel)
+     int err;
+     struct v2v_channel *channel = (struct v2v_channel *)_channel;
+-    /* The grant mapping and vm areas are cleaned up in v2v_destroy_channel() */ 
++    /* Have to clean up the grant mapping and vm areas here before setting the state to disconnected
++       or the temple disconnect could fail. */ 
++    v2v_xenops_grant_unmap(channel->u.supplicant.prod_area,
++                           channel->u.supplicant.prod_shmem_handles,
++                           channel->nr_cons_ring_pages,
++                           1);
++    channel->u.supplicant.prod_area = NULL;
++
++    v2v_xenops_grant_unmap(channel->u.supplicant.cons_area,
++                           channel->u.supplicant.cons_shmem_handles,
++                           channel->nr_prod_ring_pages,
++                           0);
++    channel->u.supplicant.cons_area = NULL;
++
++    v2v_xenops_grant_unmap(channel->u.supplicant.control_area,
++                           &channel->u.supplicant.control_shmem_handle,
++                           1,
++                           0);
++    channel->u.supplicant.control_area = NULL;
++
+     channel->prod_sring = NULL;
+     channel->cons_sring = NULL;
+     channel->control = NULL;
+@@ -1261,6 +1280,7 @@ v2v_disconnect_supplicant(const struct v2v_channel *_channel)
+     v2v_close_receive_evtchn(channel);
+     v2v_close_send_evtchn(channel);
++    /* Now go to the disconnected state and clean everything up. */
+     err = v2v_change_local_state(channel, XBT_NIL, v2v_state_disconnected);
+     if (err) {
+         EPRINTK("v2v_disconnect_supplicant - v2v_change_local_state(disconnected) failed - err: %d\n", err);