Skip to contentSkip to conversation

Reset pos in cr_write_pids()

PATCH In review Sukadev Bhattiprolu 2 participants 3 messages Jan 22, 2009 – Jan 23, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Reset pos in cr_write_pids()

Noticed this while reviewing the code in [v12] branch of your git tree.

---
From: Sukadev Bhattiprolu <suka@sukaT61.(none)>
Date: Wed, 21 Jan 2009 21:10:34 -0800
Subject: [PATCH] Reset pos in cr_write_pids()

If the number of tasks exceed CR_HDR_PIDS_CHUNK, pos must be reset for a second iteration in the outer loop.

---
 checkpoint/checkpoint.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
checkpoint/checkpoint.c +2 -1
index fbcd9eb..3136850 100644
@@ -297,7 +297,7 @@ static int cr_write_pids(struct cr_ctx *ctx)
 	struct pid_namespace *ns;
 	struct task_struct *task;
 	struct task_struct **tasks_arr;
-	int tasks_nr, n, ret = 0, pos = 0;
+	int tasks_nr, n, ret = 0, pos;
 
 	ns = ctx->root_nsproxy->pid_ns;
 	tasks_arr = ctx->tasks_arr;
@@ -306,6 +306,7 @@ static int cr_write_pids(struct cr_ctx *ctx)
 	hh = cr_hbuf_get(ctx, sizeof(*hh) * CR_HDR_PIDS_CHUNK);
 
 	while (tasks_nr > 0) {
+		pos = 0;
 		rcu_read_lock();
 		for (n = min(tasks_nr, CR_HDR_PIDS_CHUNK); n; n--) {
 			task = tasks_arr[pos];
Signature · 1 line
1.5.4.3

A message that is not in the archive (sent off-list or not yet received): 20090122051407.GA20039-r/[email protected]

#2 lore raw

Fix typo in Oren's address

---
Oren,

Noticed this while reviewing the code in [v12] branch of your git tree.

---
From: Sukadev Bhattiprolu <suka@sukaT61.(none)>
Date: Wed, 21 Jan 2009 21:10:34 -0800
Subject: [PATCH] Reset pos in cr_write_pids()

If the number of tasks exceed CR_HDR_PIDS_CHUNK, pos must be reset for a second iteration in the outer loop.

---
 checkpoint/checkpoint.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
checkpoint/checkpoint.c +2 -1
index fbcd9eb..3136850 100644
@@ -297,7 +297,7 @@ static int cr_write_pids(struct cr_ctx *ctx)
 	struct pid_namespace *ns;
 	struct task_struct *task;
 	struct task_struct **tasks_arr;
-	int tasks_nr, n, ret = 0, pos = 0;
+	int tasks_nr, n, ret = 0, pos;
 
 	ns = ctx->root_nsproxy->pid_ns;
 	tasks_arr = ctx->tasks_arr;
@@ -306,6 +306,7 @@ static int cr_write_pids(struct cr_ctx *ctx)
 	hh = cr_hbuf_get(ctx, sizeof(*hh) * CR_HDR_PIDS_CHUNK);
 
 	while (tasks_nr > 0) {
+		pos = 0;
 		rcu_read_lock();
 		for (n = min(tasks_nr, CR_HDR_PIDS_CHUNK); n; n--) {
 			task = tasks_arr[pos];
Signature · 1 line
1.5.4.3
#3 lore raw
In reply to a message not in the archive
Quoted 1 line · Sukadev Bhattiprolu

Noticed this while reviewing the code in [v12] branch of your git tree.

Thanks. Will fix.

Oren.

Quoted 33 lines

---
From: Sukadev Bhattiprolu <suka@sukaT61.(none)>
Date: Wed, 21 Jan 2009 21:10:34 -0800
Subject: [PATCH] Reset pos in cr_write_pids()

If the number of tasks exceed CR_HDR_PIDS_CHUNK, pos must be reset for a second iteration in the outer loop.

---
 checkpoint/checkpoint.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
checkpoint/checkpoint.c +2 -1
index fbcd9eb..3136850 100644
@@ -297,7 +297,7 @@ static int cr_write_pids(struct cr_ctx *ctx)
 	struct pid_namespace *ns;
 	struct task_struct *task;
 	struct task_struct **tasks_arr;
-	int tasks_nr, n, ret = 0, pos = 0;
+	int tasks_nr, n, ret = 0, pos;
 
 	ns = ctx->root_nsproxy->pid_ns;
 	tasks_arr = ctx->tasks_arr;
@@ -306,6 +306,7 @@ static int cr_write_pids(struct cr_ctx *ctx)
 	hh = cr_hbuf_get(ctx, sizeof(*hh) * CR_HDR_PIDS_CHUNK);
 
 	while (tasks_nr > 0) {
+		pos = 0;
 		rcu_read_lock();
 		for (n = min(tasks_nr, CR_HDR_PIDS_CHUNK); n; n--) {
 			task = tasks_arr[pos];