summaryrefslogtreecommitdiffstats
path: root/ipc/util.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-11-21 08:57:04 +0100
committerIngo Molnar <mingo@elte.hu>2008-11-21 08:57:04 +0100
commitfc02e90c34bacd5d7bc77b832c65a8f06e1bd60e (patch)
treed870acafa2290779aa7c0594172bf1c691d3e6c0 /ipc/util.c
parentsched: fix inconsistency when redistribute per-cpu tg->cfs_rq shares (diff)
parentLinux 2.6.28-rc6 (diff)
downloadlinux-fc02e90c34bacd5d7bc77b832c65a8f06e1bd60e.tar.xz
linux-fc02e90c34bacd5d7bc77b832c65a8f06e1bd60e.zip
Merge commit 'v2.6.28-rc6' into sched/core
Diffstat (limited to 'ipc/util.c')
-rw-r--r--ipc/util.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ipc/util.c b/ipc/util.c
index 49b3ea615dc5..361fd1c96fcf 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -266,9 +266,17 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size)
if (ids->in_use >= size)
return -ENOSPC;
+ spin_lock_init(&new->lock);
+ new->deleted = 0;
+ rcu_read_lock();
+ spin_lock(&new->lock);
+
err = idr_get_new(&ids->ipcs_idr, new, &id);
- if (err)
+ if (err) {
+ spin_unlock(&new->lock);
+ rcu_read_unlock();
return err;
+ }
ids->in_use++;
@@ -280,10 +288,6 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size)
ids->seq = 0;
new->id = ipc_buildid(id, new->seq);
- spin_lock_init(&new->lock);
- new->deleted = 0;
- rcu_read_lock();
- spin_lock(&new->lock);
return id;
}