From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 5/16] sysfs: remove duplicated dput in sysfs_update_file
Date: Wed, 18 Oct 2006 13:08:56 -0700 [thread overview]
Message-ID: <11612021603361-git-send-email-greg@kroah.com> (raw)
In-Reply-To: <11612021563449-git-send-email-greg@kroah.com>
From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
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 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 146f1de..93218cc 100644
--- a/fs/sysfs/file.c
+++ b/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);
--
1.4.2.4
next prev parent reply other threads:[~2006-10-18 20:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-18 19:58 [GIT PATCH] Driver Core fixes for 2.6.19-rc2 Greg KH
2006-10-18 20:08 ` [PATCH 1/16] Documentation: feature-removal-schedule typo Greg KH
2006-10-18 20:08 ` [PATCH 2/16] Driver core: plug device probe memory leak Greg KH
2006-10-18 20:08 ` [PATCH 3/16] Fix dev_printk() is now GPL-only Greg KH
2006-10-18 20:08 ` [PATCH 4/16] HOWTO: bug report addition Greg KH
2006-10-18 20:08 ` Greg KH [this message]
2006-10-18 20:08 ` [PATCH 6/16] sysfs: update obsolete comment in sysfs_update_file Greg KH
2006-10-18 20:08 ` [PATCH 7/16] driver core fixes: sysfs_create_link() retval check in class.c Greg KH
2006-10-18 20:08 ` [PATCH 8/16] driver core fixes: bus_add_attrs() retval check Greg KH
2006-10-18 20:09 ` [PATCH 9/16] driver core fixes: bus_add_device() cleanup on error Greg KH
2006-10-18 20:09 ` [PATCH 10/16] driver core fixes: device_add() " Greg KH
2006-10-18 20:09 ` [PATCH 11/16] driver core fixes: device_create_file() retval check in dmapool.c Greg KH
2006-10-18 20:09 ` [PATCH 12/16] driver core fixes: sysfs_create_group() retval in topology.c Greg KH
2006-10-18 20:09 ` [PATCH 13/16] Driver core: Don't leak 'old_class_name' in drivers/base/core.c::device_rename() Greg KH
2006-10-18 20:09 ` [PATCH 14/16] Driver core: Don't ignore error returns from probing Greg KH
2006-10-18 20:09 ` [PATCH 15/16] Driver core: bus: remove indentation level Greg KH
2006-10-18 20:09 ` [PATCH 16/16] driver core: kmalloc() failure check in driver_probe_device Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11612021603361-git-send-email-greg@kroah.com \
--to=greg@kroah.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=seto.hidetoshi@jp.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox