dump/files: remove a leftover from dead_pid_conflict

Submitted by Pavel Tikhomirov on July 19, 2018, 8:28 a.m.

Details

Message ID 20180719082800.31664-1-ptikhomirov@virtuozzo.com
State New
Series "dump/files: remove a leftover from dead_pid_conflict"
Headers show

Commit Message

Pavel Tikhomirov July 19, 2018, 8:28 a.m.
In commit 23b769498cb3 ("dump: optimize dead_pid_conflict by searching
in rbtree") we'd replaced for_each_pstree_item and thread walk search
with pstree_pid_by_virt (rb-tree search). The latter already found us
the thread with conflicting pid if it exists, the only thing left is to
skip if the thread is also a main thread of the thread group (as it was
before patch). But some leftover left which checks something wrong: we
index ->threads array with "i", but "i" is not a number of the thread
it is a number of current dead pid.

Not sure if it helps with the initial bug and duplicates, but it might:
https://jira.sw.ru/browse/PSBM-55217

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 criu/files-reg.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/files-reg.c b/criu/files-reg.c
index 112acc159..b3fc41357 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -1006,18 +1006,9 @@  int dead_pid_conflict(void)
 		if (!node)
 			continue;
 
-		if (node->state != TASK_THREAD) {
-			struct pstree_item *item;
-
-			/*
-			 * If the dead PID was given to a main thread of another
-			 * process, this is handled during restore.
-			 */
-			item = node->item;
-			if (item->pid->real == item->threads[i].real ||
-			    item->threads[i].ns[0].virt != pid)
-				continue;
-		}
+		/* Main thread */
+		if (node->state != TASK_THREAD)
+			continue;
 
 		pr_err("Conflict with a dead task with the same PID as of this thread (virt %d, real %d).\n",
 			node->ns[0].virt, node->real);

Comments

Pavel Tikhomirov Aug. 7, 2018, 1:02 p.m.
ping

On 07/19/2018 11:28 AM, Pavel Tikhomirov wrote:
> In commit 23b769498cb3 ("dump: optimize dead_pid_conflict by searching
> in rbtree") we'd replaced for_each_pstree_item and thread walk search
> with pstree_pid_by_virt (rb-tree search). The latter already found us
> the thread with conflicting pid if it exists, the only thing left is to
> skip if the thread is also a main thread of the thread group (as it was
> before patch). But some leftover left which checks something wrong: we
> index ->threads array with "i", but "i" is not a number of the thread
> it is a number of current dead pid.
> 
> Not sure if it helps with the initial bug and duplicates, but it might:
> https://jira.sw.ru/browse/PSBM-55217
> 
> Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
> ---
>   criu/files-reg.c | 15 +++------------
>   1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/criu/files-reg.c b/criu/files-reg.c
> index 112acc159..b3fc41357 100644
> --- a/criu/files-reg.c
> +++ b/criu/files-reg.c
> @@ -1006,18 +1006,9 @@ int dead_pid_conflict(void)
>   		if (!node)
>   			continue;
>   
> -		if (node->state != TASK_THREAD) {
> -			struct pstree_item *item;
> -
> -			/*
> -			 * If the dead PID was given to a main thread of another
> -			 * process, this is handled during restore.
> -			 */
> -			item = node->item;
> -			if (item->pid->real == item->threads[i].real ||
> -			    item->threads[i].ns[0].virt != pid)
> -				continue;
> -		}
> +		/* Main thread */
> +		if (node->state != TASK_THREAD)
> +			continue;
>   
>   		pr_err("Conflict with a dead task with the same PID as of this thread (virt %d, real %d).\n",
>   			node->ns[0].virt, node->real);
>