aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/tmem.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-11-14 10:32:59 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-11-14 10:32:59 +0000
commit6ae724388531135f6c405d21543abdde972f255f (patch)
treec8e2487aa4666943efc913cc1db5177302837c28 /xen/common/tmem.c
parentf60cd0f902a383b094e376b7a8f855c26b07d400 (diff)
downloadxen-6ae724388531135f6c405d21543abdde972f255f.tar.gz
xen-6ae724388531135f6c405d21543abdde972f255f.tar.bz2
xen-6ae724388531135f6c405d21543abdde972f255f.zip
tmem: fix domain shutdown problem/race
Tmem fails to put_domain so a dying domain never gets properly shut down. Also, fix race condition when domain is dying by not allowing any new ops to succeed. Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Diffstat (limited to 'xen/common/tmem.c')
-rw-r--r--xen/common/tmem.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/xen/common/tmem.c b/xen/common/tmem.c
index 55c2aabdad..806f543962 100644
--- a/xen/common/tmem.c
+++ b/xen/common/tmem.c
@@ -2229,6 +2229,12 @@ EXPORT long do_tmem_op(tmem_cli_op_t uops)
DUP_START_CYC_COUNTER(flush,succ_get);
DUP_START_CYC_COUNTER(flush_obj,succ_get);
+ if ( client != NULL && tmh_client_is_dying(client) )
+ {
+ rc = -ENODEV;
+ goto out;
+ }
+
if ( unlikely(tmh_get_tmemop_from_client(&op, uops) != 0) )
{
printk("tmem: can't get tmem struct from %s\n",client_str);
@@ -2392,6 +2398,12 @@ EXPORT void tmem_destroy(void *v)
if ( client == NULL )
return;
+ if ( !tmh_client_is_dying(client) )
+ {
+ printk("tmem: tmem_destroy can only destroy dying client\n");
+ return;
+ }
+
if ( tmh_lock_all )
spin_lock(&tmem_spinlock);
else