Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964847AbWJJRP7 (ORCPT ); Tue, 10 Oct 2006 13:15:59 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S964830AbWJJRP6 (ORCPT ); Tue, 10 Oct 2006 13:15:58 -0400 Received: from mail.kroah.org ([69.55.234.183]:58249 "EHLO perch.kroah.org") by vger.kernel.org with ESMTP id S964821AbWJJRPm (ORCPT ); Tue, 10 Oct 2006 13:15:42 -0400 Date: Tue, 10 Oct 2006 10:14:59 -0700 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , torvalds@osdl.org, akpm@osdl.org, alan@lxorguk.ukuu.org.uk, Hidetoshi Seto , Greg Kroah-Hartman Subject: [patch 09/19] sysfs: remove duplicated dput in sysfs_update_file Message-ID: <20061010171459.GJ6339@kroah.com> References: <20061010165621.394703368@quad.kroah.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="sysfs-remove-duplicated-dput-in-sysfs_update_file.patch" In-Reply-To: <20061010171350.GA6339@kroah.com> User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2581 Lines: 83 -stable review patch. If anyone has any objections, please let us know. ------------------ From: Hidetoshi Seto Following function can drops d_count twice against one reference by lookup_one_len. /** * 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; } 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 Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/sysfs/file.c | 5 ----- 1 file changed, 5 deletions(-) --- linux-2.6.17.13.orig/fs/sysfs/file.c +++ linux-2.6.17.13/fs/sysfs/file.c @@ -483,11 +483,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); -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/