linux/fs/sysfs
Eric W. Biederman 846f99749a sysfs: Add lockdep annotations for the sysfs active reference
Holding locks over device_del -> kobject_del -> sysfs_deactivate can
cause deadlocks if those same locks are grabbed in sysfs show or store
methods.

The I model s_active count + completion as a sleeping read/write lock.
I describe to lockdep sysfs_get_active as a read_trylock,
sysfs_put_active as a read_unlock, and sysfs_deactivate as a
write_lock and write_unlock pair.  This seems to capture the essence
for purposes of finding deadlocks, and in my testing gives finds real
issues and ignores non-issues.

This brings us back to holding locks over kobject_del is a problem
that ideally we should find a way of addressing, but at least lockdep
can tell us about the problems instead of requiring developers to debug
rare strange system deadlocks, that happen when sysfs files are removed
while being written to.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-01-04 12:34:46 -08:00
..
bin.c Driver core: bin_attribute parameters can often be const* 2009-12-23 11:23:43 -08:00
dir.c sysfs: Add lockdep annotations for the sysfs active reference 2010-01-04 12:34:46 -08:00
file.c sysfs: In sysfs_chmod_file lazily propagate the mode change. 2009-12-11 11:24:54 -08:00
group.c Use WARN() in fs/sysfs 2008-07-26 12:00:07 -07:00
inode.c sysfs: sysfs_setattr remove unnecessary permission check. 2009-12-11 11:24:54 -08:00
Kconfig fs/Kconfig: move sysfs out 2009-01-22 13:15:56 +03:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mount.c sysfs: reference sysfs_dirent from sysfs inodes 2009-03-24 16:38:25 -07:00
symlink.c sysfs: Implement sysfs_getattr & sysfs_permission 2009-12-11 11:24:54 -08:00
sysfs.h sysfs: Add lockdep annotations for the sysfs active reference 2010-01-04 12:34:46 -08:00