All of lore.kernel.org
 help / color / mirror / Atom feed
* + proc-remove-useless-checks-in-proc_register.patch added to -mm tree
@ 2007-11-16 21:50 akpm
  0 siblings, 0 replies; 2+ messages in thread
From: akpm @ 2007-11-16 21:50 UTC (permalink / raw)
  To: mm-commits; +Cc: adobriyan


The patch titled
     proc: remove useless checks in proc_register()
has been added to the -mm tree.  Its filename is
     proc-remove-useless-checks-in-proc_register.patch

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

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: proc: remove useless checks in proc_register()
From: Alexey Dobriyan <adobriyan@sw.ru>

Before proc_register() all PDEs are created by proc_create() which doesn't set
->proc_iops and ->proc_fops -- they're NULL.  So those branches in
proc_register() are always taken.

Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/proc/generic.c |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff -puN fs/proc/generic.c~proc-remove-useless-checks-in-proc_register fs/proc/generic.c
--- a/fs/proc/generic.c~proc-remove-useless-checks-in-proc_register
+++ a/fs/proc/generic.c
@@ -526,19 +526,14 @@ static int proc_register(struct proc_dir
 	dp->low_ino = i;
 
 	if (S_ISDIR(dp->mode)) {
-		if (dp->proc_iops == NULL) {
-			dp->proc_fops = &proc_dir_operations;
-			dp->proc_iops = &proc_dir_inode_operations;
-		}
+		dp->proc_fops = &proc_dir_operations;
+		dp->proc_iops = &proc_dir_inode_operations;
 		dir->nlink++;
 	} else if (S_ISLNK(dp->mode)) {
-		if (dp->proc_iops == NULL)
-			dp->proc_iops = &proc_link_inode_operations;
+		dp->proc_iops = &proc_link_inode_operations;
 	} else if (S_ISREG(dp->mode)) {
-		if (dp->proc_fops == NULL)
-			dp->proc_fops = &proc_file_operations;
-		if (dp->proc_iops == NULL)
-			dp->proc_iops = &proc_file_inode_operations;
+		dp->proc_fops = &proc_file_operations;
+		dp->proc_iops = &proc_file_inode_operations;
 	}
 
 	spin_lock(&proc_subdir_lock);
_

Patches currently in -mm which might be from adobriyan@sw.ru are

origin.patch
proc-remove-module_license.patch
proc-less-lock-operations-during-lookup.patch
proc-simplify-function-prototypes.patch
proc-remove-useless-check-on-symlink-removal.patch
proc-remove-useless-checks-in-proc_register.patch
single_open-seq_release-leak-diagnostics.patch

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

* Re: + proc-remove-useless-checks-in-proc_register.patch added to -mm tree
@ 2007-12-27 10:38 Alexey Dobriyan
  0 siblings, 0 replies; 2+ messages in thread
From: Alexey Dobriyan @ 2007-12-27 10:38 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

In fact, Andrew, please, drop this patch. Fixing yet another race in
proc would be done by suppying PDE's with valid ->proc_fops before
proc_register(), so this patch would be effectively reverted.

>      proc-remove-useless-checks-in-proc_register.patch

> Subject: proc: remove useless checks in proc_register()
> From: Alexey Dobriyan <adobriyan@sw.ru>
> 
> Before proc_register() all PDEs are created by proc_create() which doesn't set
> ->proc_iops and ->proc_fops -- they're NULL.  So those branches in
> proc_register() are always taken.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  fs/proc/generic.c |   15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff -puN fs/proc/generic.c~proc-remove-useless-checks-in-proc_register fs/proc/generic.c
> --- a/fs/proc/generic.c~proc-remove-useless-checks-in-proc_register
> +++ a/fs/proc/generic.c
> @@ -526,19 +526,14 @@ static int proc_register(struct proc_dir
>  	dp->low_ino = i;
>  
>  	if (S_ISDIR(dp->mode)) {
> -		if (dp->proc_iops == NULL) {
> -			dp->proc_fops = &proc_dir_operations;
> -			dp->proc_iops = &proc_dir_inode_operations;
> -		}
> +		dp->proc_fops = &proc_dir_operations;
> +		dp->proc_iops = &proc_dir_inode_operations;
>  		dir->nlink++;
>  	} else if (S_ISLNK(dp->mode)) {
> -		if (dp->proc_iops == NULL)
> -			dp->proc_iops = &proc_link_inode_operations;
> +		dp->proc_iops = &proc_link_inode_operations;
>  	} else if (S_ISREG(dp->mode)) {
> -		if (dp->proc_fops == NULL)
> -			dp->proc_fops = &proc_file_operations;
> -		if (dp->proc_iops == NULL)
> -			dp->proc_iops = &proc_file_inode_operations;
> +		dp->proc_fops = &proc_file_operations;
> +		dp->proc_iops = &proc_file_inode_operations;
>  	}
>  
>  	spin_lock(&proc_subdir_lock);


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

end of thread, other threads:[~2007-12-27 11:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-27 10:38 + proc-remove-useless-checks-in-proc_register.patch added to -mm tree Alexey Dobriyan
  -- strict thread matches above, loose matches on Subject: below --
2007-11-16 21:50 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.