linux/fs/sysfs
Tejun Heo a8b1474442 sysfs: give different locking key to regular and bin files
027a485d12 ("sysfs: use a separate locking class for open files
depending on mmap") assigned different lockdep key to
sysfs_open_file->mutex depending on whether the file implements mmap
or not in an attempt to avoid spurious lockdep warning caused by
merging of regular and bin file paths.

While this restored some of the original behavior of using different
locks (at least lockdep is concerned) for the different clases of
files.  The restoration wasn't full because now the lockdep key
assignment depends on whether the file has mmap or not instead of
whether it's a regular file or not.

This means that bin files which don't implement mmap will get assigned
the same lockdep class as regular files.  This is problematic because
file_operations for bin files still implements the mmap file operation
and checking whether the sysfs file actually implements mmap happens
in the file operation after grabbing @sysfs_open_file->mutex.  We
still end up adding locking dependency from mmap locking to
sysfs_open_file->mutex to the regular file mutex which triggers
spurious circular locking warning.

Fix it by restoring the original behavior fully by differentiating
lockdep key by whether the file is regular or bin, instead of the
existence of mmap.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Dave Jones <davej@redhat.com>
Link: http://lkml.kernel.org/g/20131203184324.GA11320@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-07 21:22:00 -08:00
..
dir.c Revert "sysfs: drop kobj_ns_type handling" 2013-11-07 20:47:28 +09:00
file.c sysfs: give different locking key to regular and bin files 2013-12-07 21:22:00 -08:00
group.c Revert "sysfs: handle duplicate removal attempts in sysfs_remove_group()" 2013-11-27 09:44:55 -08:00
inode.c sysfs: move sysfs_hash_and_remove() to fs/sysfs/dir.c 2013-10-29 15:12:07 -07:00
Kconfig kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT 2011-01-20 17:02:05 -08:00
Makefile sysfs: merge regular and bin file handling 2013-10-05 17:27:40 -07:00
mount.c Revert "sysfs: drop kobj_ns_type handling" 2013-11-07 20:47:28 +09:00
symlink.c Revert "sysfs: drop kobj_ns_type handling" 2013-11-07 20:47:28 +09:00
sysfs.h Revert "sysfs: drop kobj_ns_type handling" 2013-11-07 20:47:28 +09:00