[CRIU] [PATCH v2 2/8] ipc: "use key as id" functionality for new
segment allocation introduced
Stanislav Kinsbursky
skinsbursky at parallels.com
Wed Feb 8 08:18:06 EST 2012
Signed-off-by: Stanislav Kinsbursky <skinsbursky at parallels.com>
---
ipc/util.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/ipc/util.c b/ipc/util.c
index aaa57fd..824199c 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -284,7 +284,7 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size)
rcu_read_lock();
spin_lock(&new->lock);
- err = idr_get_new(&ids->ipcs_idr, new, &id);
+ err = idr_get_new_above(&ids->ipcs_idr, new, ipcid_to_idx(new->id), &id);
if (err) {
spin_unlock(&new->lock);
rcu_read_unlock();
@@ -297,6 +297,9 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size)
new->cuid = new->uid = euid;
new->gid = new->cgid = egid;
+ if (new->id)
+ return id;
+
new->seq = ids->seq++;
if(ids->seq > ids->seq_max)
ids->seq = 0;
More information about the CRIU
mailing list