All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.18] sysfs: remove duplicated dput in sysfs_update_file
@ 2006-09-20  7:38 Hidetoshi Seto
  2006-09-20  7:49 ` [PATCH 2.6.18] sysfs: update obsolete comment " Hidetoshi Seto
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hidetoshi Seto @ 2006-09-20  7:38 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux Kernel list

Following function can drops d_count twice against one reference
by lookup_one_len.

<SOURCE>
/**
 * sysfs_update_file - update the modified timestamp on an object attribute.
 * @kobj: object we're acting for.
 * @attr: attribute descriptor.
 */
int sysfs_update_file(struct kobject * kobj, const struct attribute * attr)
{
        struct dentry * dir = kobj->dentry;
        struct dentry * victim;
        int res = -ENOENT;

        mutex_lock(&dir->d_inode->i_mutex);
        victim = lookup_one_len(attr->name, dir, strlen(attr->name));
        if (!IS_ERR(victim)) {
                /* make sure dentry is really there */
                if (victim->d_inode &&
                    (victim->d_parent->d_inode == dir->d_inode)) {
                        victim->d_inode->i_mtime = CURRENT_TIME;
                        fsnotify_modify(victim);

                        /**
                         * Drop reference from initial sysfs_get_dentry().
                         */
                        dput(victim);
                        res = 0;
                } else
                        d_drop(victim);

                /**
                 * Drop the reference acquired from sysfs_get_dentry() above.
                 */
                dput(victim);
        }
        mutex_unlock(&dir->d_inode->i_mutex);

        return res;
}
</SOURCE>

PCI-hotplug (drivers/pci/hotplug/pci_hotplug_core.c) is only user of
this function. I confirmed that dentry of /sys/bus/pci/slots/XXX/*
have negative d_count value.

This patch removes unnecessary dput().

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>

---
 fs/sysfs/file.c |    5 -----
 1 files changed, 5 deletions(-)

Index: linux-2.6.18/fs/sysfs/file.c
===================================================================
--- linux-2.6.18.orig/fs/sysfs/file.c
+++ linux-2.6.18/fs/sysfs/file.c
@@ -483,11 +483,6 @@
 		    (victim->d_parent->d_inode == dir->d_inode)) {
 			victim->d_inode->i_mtime = CURRENT_TIME;
 			fsnotify_modify(victim);
-
-			/**
-			 * Drop reference from initial sysfs_get_dentry().
-			 */
-			dput(victim);
 			res = 0;
 		} else
 			d_drop(victim);


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

* Re: [PATCH 2.6.18] sysfs: update obsolete comment in sysfs_update_file
  2006-09-20  7:38 [PATCH 2.6.18] sysfs: remove duplicated dput in sysfs_update_file Hidetoshi Seto
@ 2006-09-20  7:49 ` Hidetoshi Seto
  2006-09-28  7:02   ` patch sysfs-update-obsolete-comment-in-sysfs_update_file.patch added to gregkh-2.6 tree gregkh
  2006-09-21  3:19 ` [PATCH 2.6.18] sysfs: remove duplicated dput in sysfs_update_file Maneesh Soni
  2006-09-28  7:02 ` patch sysfs-remove-duplicated-dput-in-sysfs_update_file.patch added to gregkh-2.6 tree gregkh
  2 siblings, 1 reply; 5+ messages in thread
From: Hidetoshi Seto @ 2006-09-20  7:49 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux Kernel list

And the obsolete comment should be updated (or totally removed).

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
---
 fs/sysfs/file.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.18/fs/sysfs/file.c
===================================================================
--- linux-2.6.18.orig/fs/sysfs/file.c
+++ linux-2.6.18/fs/sysfs/file.c
@@ -488,7 +488,7 @@
 			d_drop(victim);
 		
 		/**
-		 * Drop the reference acquired from sysfs_get_dentry() above.
+		 * Drop the reference acquired from lookup_one_len() above.
 		 */
 		dput(victim);
 	}



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

* Re: [PATCH 2.6.18] sysfs: remove duplicated dput in sysfs_update_file
  2006-09-20  7:38 [PATCH 2.6.18] sysfs: remove duplicated dput in sysfs_update_file Hidetoshi Seto
  2006-09-20  7:49 ` [PATCH 2.6.18] sysfs: update obsolete comment " Hidetoshi Seto
@ 2006-09-21  3:19 ` Maneesh Soni
  2006-09-28  7:02 ` patch sysfs-remove-duplicated-dput-in-sysfs_update_file.patch added to gregkh-2.6 tree gregkh
  2 siblings, 0 replies; 5+ messages in thread
From: Maneesh Soni @ 2006-09-21  3:19 UTC (permalink / raw)
  To: Hidetoshi Seto; +Cc: Greg KH, Linux Kernel list

On Wed, Sep 20, 2006 at 04:38:00PM +0900, Hidetoshi Seto wrote:
> Following function can drops d_count twice against one reference
> by lookup_one_len.
> 
> <SOURCE>
> /**
>  * sysfs_update_file - update the modified timestamp on an object attribute.
>  * @kobj: object we're acting for.
>  * @attr: attribute descriptor.
>  */
> int sysfs_update_file(struct kobject * kobj, const struct attribute * attr)
> {
>         struct dentry * dir = kobj->dentry;
>         struct dentry * victim;
>         int res = -ENOENT;
> 
>         mutex_lock(&dir->d_inode->i_mutex);
>         victim = lookup_one_len(attr->name, dir, strlen(attr->name));
>         if (!IS_ERR(victim)) {
>                 /* make sure dentry is really there */
>                 if (victim->d_inode &&
>                     (victim->d_parent->d_inode == dir->d_inode)) {
>                         victim->d_inode->i_mtime = CURRENT_TIME;
>                         fsnotify_modify(victim);
> 
>                         /**
>                          * Drop reference from initial sysfs_get_dentry().
>                          */
>                         dput(victim);
>                         res = 0;
>                 } else
>                         d_drop(victim);
> 
>                 /**
>                  * Drop the reference acquired from sysfs_get_dentry() above.
>                  */
>                 dput(victim);
>         }
>         mutex_unlock(&dir->d_inode->i_mutex);
> 
>         return res;
> }
> </SOURCE>
> 
> PCI-hotplug (drivers/pci/hotplug/pci_hotplug_core.c) is only user of
> this function. I confirmed that dentry of /sys/bus/pci/slots/XXX/*
> have negative d_count value.
> 
> This patch removes unnecessary dput().
> 
> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
> 
> ---
>  fs/sysfs/file.c |    5 -----
>  1 files changed, 5 deletions(-)
> 
> Index: linux-2.6.18/fs/sysfs/file.c
> ===================================================================
> --- linux-2.6.18.orig/fs/sysfs/file.c
> +++ linux-2.6.18/fs/sysfs/file.c
> @@ -483,11 +483,6 @@
>  		    (victim->d_parent->d_inode == dir->d_inode)) {
>  			victim->d_inode->i_mtime = CURRENT_TIME;
>  			fsnotify_modify(victim);
> -
> -			/**
> -			 * Drop reference from initial sysfs_get_dentry().
> -			 */
> -			dput(victim);
>  			res = 0;
>  		} else
>  			d_drop(victim);
> 
> -
> 

Looks good to me..

Thanks
Maneesh

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

* patch sysfs-remove-duplicated-dput-in-sysfs_update_file.patch added to gregkh-2.6 tree
  2006-09-20  7:38 [PATCH 2.6.18] sysfs: remove duplicated dput in sysfs_update_file Hidetoshi Seto
  2006-09-20  7:49 ` [PATCH 2.6.18] sysfs: update obsolete comment " Hidetoshi Seto
  2006-09-21  3:19 ` [PATCH 2.6.18] sysfs: remove duplicated dput in sysfs_update_file Maneesh Soni
@ 2006-09-28  7:02 ` gregkh
  2 siblings, 0 replies; 5+ messages in thread
From: gregkh @ 2006-09-28  7:02 UTC (permalink / raw)
  To: seto.hidetoshi, gregkh, linux-kernel, maneesh


This is a note to let you know that I've just added the patch titled

     Subject: sysfs: remove duplicated dput in sysfs_update_file

to my gregkh-2.6 tree.  Its filename is

     sysfs-remove-duplicated-dput-in-sysfs_update_file.patch

This tree can be found at 
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/


>From seto.hidetoshi@jp.fujitsu.com Wed Sep 20 00:35:46 2006
Message-ID: <4510EFD8.2050608@jp.fujitsu.com>
Date: Wed, 20 Sep 2006 16:38:00 +0900
From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
To: Greg KH <gregkh@suse.de>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: sysfs: remove duplicated dput in sysfs_update_file

Following function can drops d_count twice against one reference
by lookup_one_len.

<SOURCE>
/**
 * sysfs_update_file - update the modified timestamp on an object attribute.
 * @kobj: object we're acting for.
 * @attr: attribute descriptor.
 */
int sysfs_update_file(struct kobject * kobj, const struct attribute * attr)
{
        struct dentry * dir = kobj->dentry;
        struct dentry * victim;
        int res = -ENOENT;

        mutex_lock(&dir->d_inode->i_mutex);
        victim = lookup_one_len(attr->name, dir, strlen(attr->name));
        if (!IS_ERR(victim)) {
                /* make sure dentry is really there */
                if (victim->d_inode &&
                    (victim->d_parent->d_inode == dir->d_inode)) {
                        victim->d_inode->i_mtime = CURRENT_TIME;
                        fsnotify_modify(victim);

                        /**
                         * Drop reference from initial sysfs_get_dentry().
                         */
                        dput(victim);
                        res = 0;
                } else
                        d_drop(victim);

                /**
                 * Drop the reference acquired from sysfs_get_dentry() above.
                 */
                dput(victim);
        }
        mutex_unlock(&dir->d_inode->i_mutex);

        return res;
}
</SOURCE>

PCI-hotplug (drivers/pci/hotplug/pci_hotplug_core.c) is only user of
this function. I confirmed that dentry of /sys/bus/pci/slots/XXX/*
have negative d_count value.

This patch removes unnecessary dput().

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Acked-by: Maneesh Soni <maneesh@in.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 fs/sysfs/file.c |    5 -----
 1 file changed, 5 deletions(-)

--- gregkh-2.6.orig/fs/sysfs/file.c
+++ gregkh-2.6/fs/sysfs/file.c
@@ -497,11 +497,6 @@ int sysfs_update_file(struct kobject * k
 		    (victim->d_parent->d_inode == dir->d_inode)) {
 			victim->d_inode->i_mtime = CURRENT_TIME;
 			fsnotify_modify(victim);
-
-			/**
-			 * Drop reference from initial sysfs_get_dentry().
-			 */
-			dput(victim);
 			res = 0;
 		} else
 			d_drop(victim);


Patches currently in gregkh-2.6 which might be from seto.hidetoshi@jp.fujitsu.com are

driver/sysfs-remove-duplicated-dput-in-sysfs_update_file.patch
driver/sysfs-update-obsolete-comment-in-sysfs_update_file.patch

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

* patch sysfs-update-obsolete-comment-in-sysfs_update_file.patch added to gregkh-2.6 tree
  2006-09-20  7:49 ` [PATCH 2.6.18] sysfs: update obsolete comment " Hidetoshi Seto
@ 2006-09-28  7:02   ` gregkh
  0 siblings, 0 replies; 5+ messages in thread
From: gregkh @ 2006-09-28  7:02 UTC (permalink / raw)
  To: seto.hidetoshi, gregkh, linux-kernel


This is a note to let you know that I've just added the patch titled

     Subject: sysfs: update obsolete comment in sysfs_update_file

to my gregkh-2.6 tree.  Its filename is

     sysfs-update-obsolete-comment-in-sysfs_update_file.patch

This tree can be found at 
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/


>From seto.hidetoshi@jp.fujitsu.com Wed Sep 20 00:46:42 2006
Message-ID: <4510F26E.2070706@jp.fujitsu.com>
Date: Wed, 20 Sep 2006 16:49:02 +0900
From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
To: Greg KH <gregkh@suse.de>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: sysfs: update obsolete comment in sysfs_update_file

And the obsolete comment should be updated (or totally removed).

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 fs/sysfs/file.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- gregkh-2.6.orig/fs/sysfs/file.c
+++ gregkh-2.6/fs/sysfs/file.c
@@ -502,7 +502,7 @@ int sysfs_update_file(struct kobject * k
 			d_drop(victim);
 		
 		/**
-		 * Drop the reference acquired from sysfs_get_dentry() above.
+		 * Drop the reference acquired from lookup_one_len() above.
 		 */
 		dput(victim);
 	}


Patches currently in gregkh-2.6 which might be from seto.hidetoshi@jp.fujitsu.com are

driver/sysfs-remove-duplicated-dput-in-sysfs_update_file.patch
driver/sysfs-update-obsolete-comment-in-sysfs_update_file.patch

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

end of thread, other threads:[~2006-09-28  7:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-20  7:38 [PATCH 2.6.18] sysfs: remove duplicated dput in sysfs_update_file Hidetoshi Seto
2006-09-20  7:49 ` [PATCH 2.6.18] sysfs: update obsolete comment " Hidetoshi Seto
2006-09-28  7:02   ` patch sysfs-update-obsolete-comment-in-sysfs_update_file.patch added to gregkh-2.6 tree gregkh
2006-09-21  3:19 ` [PATCH 2.6.18] sysfs: remove duplicated dput in sysfs_update_file Maneesh Soni
2006-09-28  7:02 ` patch sysfs-remove-duplicated-dput-in-sysfs_update_file.patch added to gregkh-2.6 tree gregkh

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.