WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] tmem: fix corner case crash on forcible d

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] tmem: fix corner case crash on forcible domain destruction
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 02 Jun 2009 10:45:12 -0700
Delivery-date: Tue, 02 Jun 2009 10:45:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1243861666 -3600
# Node ID 50134a902c66d8c3d26a4bdca9257a8dfdd1c8c9
# Parent  45447c0f7c6efcfd9928626c23300149c119bc30
tmem: fix corner case crash on forcible domain destruction

When a tmem-enabled domain is destroyed, if the domain was
using a persistent pool, the domain destruction process
to scrubs page races tmem's attempts to gracefully dismantle
data structures.  Move tmem_destroy earlier in the domain
destruction process.

Signed-off-by: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/domain.c |    5 ++---
 xen/common/tmem.c   |   16 ++++++----------
 2 files changed, 8 insertions(+), 13 deletions(-)

diff -r 45447c0f7c6e -r 50134a902c66 xen/common/domain.c
--- a/xen/common/domain.c       Mon Jun 01 14:02:26 2009 +0100
+++ b/xen/common/domain.c       Mon Jun 01 14:07:46 2009 +0100
@@ -402,6 +402,8 @@ int domain_kill(struct domain *d)
         spin_barrier(&d->domain_lock);
         evtchn_destroy(d);
         gnttab_release_mappings(d);
+        tmem_destroy(d->tmem);
+        d->tmem = NULL;
         /* fallthrough */
     case DOMDYING_dying:
         rc = domain_relinquish_resources(d);
@@ -583,9 +585,6 @@ static void complete_domain_destroy(stru
 
     grant_table_destroy(d);
 
-    if ( d->tmem != NULL )
-        tmem_destroy(d->tmem);
-
     arch_domain_destroy(d);
 
     rangeset_domain_destroy(d);
diff -r 45447c0f7c6e -r 50134a902c66 xen/common/tmem.c
--- a/xen/common/tmem.c Mon Jun 01 14:02:26 2009 +0100
+++ b/xen/common/tmem.c Mon Jun 01 14:07:46 2009 +0100
@@ -867,7 +867,6 @@ static void client_free(client_t *client
 {
     list_del(&client->client_list);
     tmh_client_destroy(client->tmh);
-    tmh_set_current_client(NULL);
     tmem_free(client,sizeof(client_t),NULL);
 }
 
@@ -1992,20 +1991,17 @@ EXPORT void tmem_destroy(void *v)
 {
     client_t *client = (client_t *)v;
 
+    if ( client == NULL )
+        return;
+
     if ( tmh_lock_all )
         spin_lock(&tmem_spinlock);
     else
         write_lock(&tmem_rwlock);
 
-    if ( client == NULL )
-        printk("tmem: can't destroy tmem pools for %s=%d\n",
-               cli_id_str,client->cli_id);
-    else
-    {
-        printk("tmem: flushing tmem pools for %s=%d\n",
-               cli_id_str,client->cli_id);
-        client_flush(client,1);
-    }
+    printk("tmem: flushing tmem pools for %s=%d\n",
+           cli_id_str, client->cli_id);
+    client_flush(client, 1);
 
     if ( tmh_lock_all )
         spin_unlock(&tmem_spinlock);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] tmem: fix corner case crash on forcible domain destruction, Xen patchbot-unstable <=