Commit ab955e9f authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Linus Torvalds

[PATCH] back out sysfs reference count change

This backs out Maneesh's sysfs patch that was recently added to the
kernel.

In its defense, the original patch did solve some fixes that could be
duplicated on SMP machines, but the side affect of the patch caused lots
of problems.  Basically it caused kobjects to get their references
incremented when files that are not present in the kobject are asked for
(udev can easily trigger this when it looks for files call "dev" in
directories that do not have that file).  This can cause easy oopses
when the VFS later ages out those old dentries and the kobject has its
reference finally released (usually after the module that the kobject
lived in was removed.)

I will continue to work with Maneesh to try to solve the original bug,
but for now, this patch needs to be applied.
parent fec1d37f
......@@ -20,18 +20,6 @@ static int init_dir(struct inode * inode)
return 0;
}
static void sysfs_d_iput(struct dentry * dentry, struct inode * inode)
{
struct kobject * kobj = dentry->d_fsdata;
if (kobj)
kobject_put(kobj);
iput(inode);
}
static struct dentry_operations sysfs_dentry_operations = {
.d_iput = &sysfs_d_iput,
};
static int create_dir(struct kobject * k, struct dentry * p,
const char * n, struct dentry ** d)
......@@ -45,8 +33,7 @@ static int create_dir(struct kobject * k, struct dentry * p,
S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO,
init_dir);
if (!error) {
(*d)->d_op = &sysfs_dentry_operations;
(*d)->d_fsdata = kobject_get(k);
(*d)->d_fsdata = k;
p->d_inode->i_nlink++;
}
dput(*d);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment