Re: 2.5.recent: device_remove_file() doesn't

From: Patrick Mochel (mochel@osdl.org)
Date: Thu Mar 27 2003 - 12:58:14 EST


On Wed, 26 Mar 2003, David Brownell wrote:

> I've noticed that recent kernels don't clean up device
> attribute files correctly when they're removed. Instead,
> they're left in the directory with a refcount of zero.
>
> That refcount stays even when the file is recreated later;
> and the contents can be read. Delete them again, and now
> the refcount is 65535 ... though now reading the contents
> may cause oopsing.
>
> This worked correctly at some point last month: the file
> no longer appeared in sysfs after deletion.
>
> Got Patch?

Yeah, and I apologize. File deletion has been causing some problems
lately due to some bad assumptions of the dentry layer. This patch reverts
a small bit of the patch that went in a couple of weeks ago, and should
hopefully fix everything up.

This should also take care of the problem that some have been seeing of
symlinks not going away on device/module removal (though I've been unable
to reproduce those).

Greg/Mike, could you give this patch a shot and let me know if helps?

Thanks,

        -pat

===== fs/sysfs/inode.c 1.84 vs edited =====
--- 1.84/fs/sysfs/inode.c Tue Mar 11 15:30:18 2003
+++ edited/fs/sysfs/inode.c Thu Mar 27 11:53:44 2003
@@ -97,7 +97,7 @@
                                  atomic_read(&victim->d_count));
 
                         simple_unlink(dir->d_inode,victim);
-
+ d_delete(victim);
                 }
                 /*
                  * Drop reference from sysfs_get_dentry() above.

-
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/



This archive was generated by hypermail 2b29 : Mon Mar 31 2003 - 22:00:29 EST