diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-05-06 11:14:17 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-05-06 11:14:17 +0100 |
commit | 3c83d63d987ece03545210ac23ff7a723e4f0243 (patch) | |
tree | 84885ca192d6d69927bcbcb198292efbb69e6db6 /xen/common/cpupool.c | |
parent | c177a9f12257b753181974fca1da88f9bbc28e80 (diff) | |
download | xen-3c83d63d987ece03545210ac23ff7a723e4f0243.tar.gz xen-3c83d63d987ece03545210ac23ff7a723e4f0243.tar.bz2 xen-3c83d63d987ece03545210ac23ff7a723e4f0243.zip |
cpupools: Fix cpupool sysctl locking.
Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Diffstat (limited to 'xen/common/cpupool.c')
-rw-r--r-- | xen/common/cpupool.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c index 6cb99773ba..c1af188bc3 100644 --- a/xen/common/cpupool.c +++ b/xen/common/cpupool.c @@ -37,6 +37,7 @@ static cpumask_t cpupool_locked_cpus = CPU_MASK_NONE; * as it was obtained! */ static DEFINE_SPINLOCK(cpupool_lock); +static DEFINE_SPINLOCK(cpupool_ctl_lock); DEFINE_PER_CPU(struct cpupool *, cpupool); @@ -401,6 +402,8 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op) int ret; struct cpupool *c; + spin_lock(&cpupool_ctl_lock); + switch ( op->op ) { @@ -426,9 +429,7 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op) case XEN_SYSCTL_CPUPOOL_OP_DESTROY: { - spin_lock(&cpupool_lock); c = cpupool_find_by_id(op->cpupool_id, 1); - spin_unlock(&cpupool_lock); ret = -ENOENT; if ( c == NULL ) break; @@ -438,9 +439,7 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op) case XEN_SYSCTL_CPUPOOL_OP_INFO: { - spin_lock(&cpupool_lock); c = cpupool_find_by_id(op->cpupool_id, 0); - spin_unlock(&cpupool_lock); ret = -ENOENT; if ( c == NULL ) break; @@ -484,9 +483,7 @@ addcpu_out: { unsigned cpu; - spin_lock(&cpupool_lock); c = cpupool_find_by_id(op->cpupool_id, 0); - spin_unlock(&cpupool_lock); ret = -ENOENT; if ( c == NULL ) break; @@ -560,6 +557,8 @@ addcpu_out: } + spin_unlock(&cpupool_ctl_lock); + return ret; } |