tmp_suning_uos_patched/fs/sysfs
Tejun Heo 26ea12dec0 kobject: grab an extra reference on kobject->sd to allow duplicate deletes
sysfs currently has a rather weird behavior regarding removals.  A
directory removal would delete all files directly under it but
wouldn't recurse into subdirectories, which, while a bit inconsistent,
seems to make sense at the first glance as each directory is
supposedly associated with a kobject and each kobject can take care of
the directory deletion; however, this doesn't really hold as we have
groups which can be directories without a kobject associated with it
and require explicit deletions.

We're in the process of separating out sysfs from kboject / driver
core and want a consistent behavior.  A removal should delete either
only the specified node or everything under it.  I think it is helpful
to support recursive atomic removal and later patches will implement
it.

Such change means that a sysfs_dirent associated with kobject may be
deleted before the kobject itself is removed if one of its ancestor
gets removed before it.  As sysfs_remove_dir() puts the base ref, we
may end up with dangling pointer on descendants.  This can be solved
by holding an extra reference on the sd from kobject.

Acquire an extra reference on the associated sysfs_dirent on directory
creation and put it after removal.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03 16:38:52 -07:00
..
bin.c sysfs: @name comes before @ns 2013-09-26 15:34:38 -07:00
dir.c kobject: grab an extra reference on kobject->sd to allow duplicate deletes 2013-10-03 16:38:52 -07:00
file.c sysfs: remove sysfs_addrm_cxt->parent_sd 2013-10-03 16:16:43 -07:00
group.c sysfs: @name comes before @ns 2013-09-26 15:34:38 -07:00
inode.c sysfs: remove sysfs_addrm_cxt->parent_sd 2013-10-03 16:16:43 -07:00
Kconfig kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT 2011-01-20 17:02:05 -08:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mount.c sysfs: drop kobj_ns_type handling 2013-09-26 15:30:22 -07:00
symlink.c sysfs: remove sysfs_addrm_cxt->parent_sd 2013-10-03 16:16:43 -07:00
sysfs.h sysfs: remove sysfs_addrm_cxt->parent_sd 2013-10-03 16:16:43 -07:00