All of lore.kernel.org
 help / color / mirror / Atom feed
* + fork-unshare-remove-dead-code.patch added to -mm tree
@ 2012-10-30 23:08 akpm
  0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2012-10-30 23:08 UTC (permalink / raw)
  To: mm-commits; +Cc: alan


The patch titled
     Subject: fork: unshare: remove dead code
has been added to the -mm tree.  Its filename is
     fork-unshare-remove-dead-code.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Alan Cox <alan@linux.intel.com>
Subject: fork: unshare: remove dead code

If new_nsproxy is set we will always call switch_task_namespaces and then
set new_nsproxy back to NULL so the reassignment and fall through check
are redundant

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/fork.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff -puN kernel/fork.c~fork-unshare-remove-dead-code kernel/fork.c
--- a/kernel/fork.c~fork-unshare-remove-dead-code
+++ a/kernel/fork.c
@@ -1792,10 +1792,8 @@ SYSCALL_DEFINE1(unshare, unsigned long, 
 			exit_sem(current);
 		}
 
-		if (new_nsproxy) {
+		if (new_nsproxy)
 			switch_task_namespaces(current, new_nsproxy);
-			new_nsproxy = NULL;
-		}
 
 		task_lock(current);
 
@@ -1819,9 +1817,6 @@ SYSCALL_DEFINE1(unshare, unsigned long, 
 		task_unlock(current);
 	}
 
-	if (new_nsproxy)
-		put_nsproxy(new_nsproxy);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: + fork-unshare-remove-dead-code.patch added to -mm tree
@ 2012-10-31 14:37 Oleg Nesterov
  0 siblings, 0 replies; 2+ messages in thread
From: Oleg Nesterov @ 2012-10-31 14:37 UTC (permalink / raw)
  To: Alan Cox, Andrew Morton; +Cc: linux-kernel

> --- a/kernel/fork.c~fork-unshare-remove-dead-code
> +++ a/kernel/fork.c
> @@ -1792,10 +1792,8 @@ SYSCALL_DEFINE1(unshare, unsigned long,
>  			exit_sem(current);
>  		}
>
> -		if (new_nsproxy) {
> +		if (new_nsproxy)
>  			switch_task_namespaces(current, new_nsproxy);
> -			new_nsproxy = NULL;
> -		}
>
>  		task_lock(current);
>
> @@ -1819,9 +1817,6 @@ SYSCALL_DEFINE1(unshare, unsigned long,
>  		task_unlock(current);
>  	}
>
> -	if (new_nsproxy)
> -		put_nsproxy(new_nsproxy);
> -

Agreed.

Perhaps it also makes sense to kill
"if (new_fs || new_fd || do_sysvsem || new_nsproxy)" ? This check
buys nothing. And without this check it is obvious why we do not
need put_nsproxy() after this block.

Oleg.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-31 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-31 14:37 + fork-unshare-remove-dead-code.patch added to -mm tree Oleg Nesterov
  -- strict thread matches above, loose matches on Subject: below --
2012-10-30 23:08 akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.