summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2008-12-04 07:16:36 +0100
committerJames Morris <jmorris@namei.org>2008-12-04 07:16:36 +0100
commitec98ce480ada787f2cfbd696980ff3564415505b (patch)
tree1a4d644b38f9f1e4b4e086fde0b195df4a92cf84 /ipc
parentMerge branch 'serge-next' into next (diff)
parentMerge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block (diff)
downloadlinux-ec98ce480ada787f2cfbd696980ff3564415505b.tar.xz
linux-ec98ce480ada787f2cfbd696980ff3564415505b.zip
Merge branch 'master' into next
Conflicts: fs/nfsd/nfs4recover.c Manually fixed above to use new creds API functions, e.g. nfs4_save_creds(). Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/util.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ipc/util.c b/ipc/util.c
index c8a76701b6c9..5a1808c774a2 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -268,9 +268,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++;
@@ -283,10 +291,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;
}