[08/11] pstree: enable sid handling back

Submitted by Pavel Tikhomirov on May 26, 2017, 5:02 p.m.

Details

Message ID 20170526170254.17038-9-ptikhomirov@virtuozzo.com
State New
Series "rework init child-reaper reparent handling for pidnses"
Headers show

Commit Message

Pavel Tikhomirov May 26, 2017, 5:02 p.m.
FIXME disable pgid, as it does not work yet

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 criu/cr-restore.c | 2 --
 criu/pstree.c     | 9 +++------
 2 files changed, 3 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 05f24fe..1f62ac2 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1477,8 +1477,6 @@  static void restore_sid(void)
 {
 	pid_t sid;
 
-	if (!list_empty(&top_pid_ns->children))
-		return;
 	/*
 	 * SID can only be reset to pid or inherited from parent.
 	 * Thus we restore it right here to let our kids inherit
diff --git a/criu/pstree.c b/criu/pstree.c
index b36210d..9141289 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -1060,9 +1060,6 @@  static int prepare_pstree_ids(void)
 	struct pstree_item *item, *helper;
 	pid_t current_pgid = getpgid(getpid());
 
-	if (!list_empty(&top_pid_ns->children))
-		return 0;
-
 	/*
 	 * Some task can be reparented to init. A helper task should be added
 	 * for restoring sid of such tasks. The helper tasks will be exited
@@ -1119,6 +1116,9 @@  static int prepare_pstree_ids(void)
 		}
 	}
 
+	if (!list_empty(&top_pid_ns->children))
+		return 0;
+
 	/* Add a process group leader if it is absent  */
 	for_each_pstree_item(item) {
 		struct pid *pid;
@@ -1369,9 +1369,6 @@  bool restore_before_setsid(struct pstree_item *child)
 {
 	int csid = child->born_sid == -1 ? vsid(child) : child->born_sid;
 
-	if (!list_empty(&top_pid_ns->children))
-		return false;
-
 	if (child->parent->born_sid == csid)
 		return true;
 

Comments

Andrey Vagin June 3, 2017, 12:31 a.m.
On Fri, May 26, 2017 at 08:02:51PM +0300, Pavel Tikhomirov wrote:
> FIXME disable pgid, as it does not work yet

I don't understand what you do in this patch. Could you write more
detailed message. Thanks

> 
> Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
> ---
>  criu/cr-restore.c | 2 --
>  criu/pstree.c     | 9 +++------
>  2 files changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/criu/cr-restore.c b/criu/cr-restore.c
> index 05f24fe..1f62ac2 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -1477,8 +1477,6 @@ static void restore_sid(void)
>  {
>  	pid_t sid;
>  
> -	if (!list_empty(&top_pid_ns->children))
> -		return;
>  	/*
>  	 * SID can only be reset to pid or inherited from parent.
>  	 * Thus we restore it right here to let our kids inherit
> diff --git a/criu/pstree.c b/criu/pstree.c
> index b36210d..9141289 100644
> --- a/criu/pstree.c
> +++ b/criu/pstree.c
> @@ -1060,9 +1060,6 @@ static int prepare_pstree_ids(void)
>  	struct pstree_item *item, *helper;
>  	pid_t current_pgid = getpgid(getpid());
>  
> -	if (!list_empty(&top_pid_ns->children))
> -		return 0;
> -
>  	/*
>  	 * Some task can be reparented to init. A helper task should be added
>  	 * for restoring sid of such tasks. The helper tasks will be exited
> @@ -1119,6 +1116,9 @@ static int prepare_pstree_ids(void)
>  		}
>  	}
>  
> +	if (!list_empty(&top_pid_ns->children))
> +		return 0;
> +
>  	/* Add a process group leader if it is absent  */
>  	for_each_pstree_item(item) {
>  		struct pid *pid;
> @@ -1369,9 +1369,6 @@ bool restore_before_setsid(struct pstree_item *child)
>  {
>  	int csid = child->born_sid == -1 ? vsid(child) : child->born_sid;
>  
> -	if (!list_empty(&top_pid_ns->children))
> -		return false;
> -
>  	if (child->parent->born_sid == csid)
>  		return true;
>  
> -- 
> 2.9.3
>
Andrey Vagin June 3, 2017, 12:37 a.m.
On Fri, Jun 02, 2017 at 05:31:24PM -0700, Andrew Vagin wrote:
> On Fri, May 26, 2017 at 08:02:51PM +0300, Pavel Tikhomirov wrote:
> > FIXME disable pgid, as it does not work yet
> 
> I don't understand what you do in this patch. Could you write more
> detailed message. Thanks

I isn't obvious who disabled sid handling and did this without comments.
> 
> > 
> > Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
> > ---
> >  criu/cr-restore.c | 2 --
> >  criu/pstree.c     | 9 +++------
> >  2 files changed, 3 insertions(+), 8 deletions(-)
> > 
> > diff --git a/criu/cr-restore.c b/criu/cr-restore.c
> > index 05f24fe..1f62ac2 100644
> > --- a/criu/cr-restore.c
> > +++ b/criu/cr-restore.c
> > @@ -1477,8 +1477,6 @@ static void restore_sid(void)
> >  {
> >  	pid_t sid;
> >  
> > -	if (!list_empty(&top_pid_ns->children))
> > -		return;
> >  	/*
> >  	 * SID can only be reset to pid or inherited from parent.
> >  	 * Thus we restore it right here to let our kids inherit
> > diff --git a/criu/pstree.c b/criu/pstree.c
> > index b36210d..9141289 100644
> > --- a/criu/pstree.c
> > +++ b/criu/pstree.c
> > @@ -1060,9 +1060,6 @@ static int prepare_pstree_ids(void)
> >  	struct pstree_item *item, *helper;
> >  	pid_t current_pgid = getpgid(getpid());
> >  
> > -	if (!list_empty(&top_pid_ns->children))
> > -		return 0;
> > -
> >  	/*
> >  	 * Some task can be reparented to init. A helper task should be added
> >  	 * for restoring sid of such tasks. The helper tasks will be exited
> > @@ -1119,6 +1116,9 @@ static int prepare_pstree_ids(void)
> >  		}
> >  	}
> >  
> > +	if (!list_empty(&top_pid_ns->children))
> > +		return 0;
> > +
> >  	/* Add a process group leader if it is absent  */
> >  	for_each_pstree_item(item) {
> >  		struct pid *pid;
> > @@ -1369,9 +1369,6 @@ bool restore_before_setsid(struct pstree_item *child)
> >  {
> >  	int csid = child->born_sid == -1 ? vsid(child) : child->born_sid;
> >  
> > -	if (!list_empty(&top_pid_ns->children))
> > -		return false;
> > -
> >  	if (child->parent->born_sid == csid)
> >  		return true;
> >  
> > -- 
> > 2.9.3
> > 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu