kernel_optimize_test/fs
Tejun Heo 4f331f01b9 vfs: don't hold s_umount over close_bdev_exclusive() call
Fix an obscure AB-BA deadlock in get_sb_bdev().

When a superblock is mounted more than once get_sb_bdev() calls
close_bdev_exclusive() to drop the extra bdev reference while holding
s_umount.  However, sb->s_umount nests inside bd_mutex during
__invalidate_device() and close_bdev_exclusive() acquires bd_mutex during
blkdev_put(); thus creating an AB-BA deadlock.

This condition doesn't trigger frequently.  For this condition to be
visible to lockdep, the filesystem must occupy the whole device (as
__invalidate_device() only grabs bd_mutex for the whole device), the FS
must be mounted more than once and partition rescan should be issued while
the FS is still mounted.

Fix it by dropping s_umount over close_bdev_exclusive().

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Ciprian Docan <docan@eden.rutgers.edu>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2010-08-09 16:48:59 -04:00
..
9p convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
adfs check ATTR_SIZE contraints in inode_change_ok 2010-08-09 16:47:39 -04:00
affs AFFS: wait for sb synchronization when needed 2010-08-09 16:48:51 -04:00
afs convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
autofs fs/: do not fallback to default_llseek() when readdir() uses BKL 2010-05-27 09:12:56 -07:00
autofs4 fs/autofs4: use memdup_user 2010-05-27 09:12:41 -07:00
befs
bfs BFS: clean up the superblock usage 2010-08-09 16:48:53 -04:00
btrfs btrfs: remove junk sb_dirt change 2010-08-09 16:48:55 -04:00
cachefiles pass a struct path to vfs_statfs 2010-08-09 16:48:42 -04:00
ceph ceph: use complete_all and wake_up_all 2010-07-27 13:11:17 -07:00
cifs cifs: truncate fallout 2010-08-09 16:48:48 -04:00
coda convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
configfs fix setattr error handling in sysfs, configfs 2010-06-04 17:16:29 -04:00
cramfs simplify get_cramfs_inode() 2010-08-09 16:47:51 -04:00
debugfs Add x64 support to debugfs 2010-05-19 22:41:57 -04:00
devpts Simplify devpts_get_sb() failure exits 2010-05-21 18:31:12 -04:00
dlm
ecryptfs pass a struct path to vfs_statfs 2010-08-09 16:48:42 -04:00
efs
exofs convert exofs to ->evict_inode() 2010-08-09 16:48:24 -04:00
exportfs
ext2 mbcache: Remove unused features 2010-08-09 16:48:45 -04:00
ext3 mbcache: Remove unused features 2010-08-09 16:48:45 -04:00
ext4 mbcache: Remove unused features 2010-08-09 16:48:45 -04:00
fat covert fatfs to ->evict_inode() 2010-08-09 16:48:01 -04:00
freevxfs convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
fscache FS-Cache: Remove unneeded null checks 2010-06-01 13:32:11 -07:00
fuse convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
gfs2 Make ->drop_inode() just return whether inode needs to be dropped 2010-08-09 16:48:35 -04:00
hfs convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
hfsplus convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
hostfs try to get rid of races in hostfs open() 2010-08-09 16:48:15 -04:00
hpfs switch hpfs to ->evict_inode() 2010-08-09 16:48:17 -04:00
hppfs switch hppfs to ->evict_inode() 2010-08-09 16:48:16 -04:00
hugetlbfs new helper: end_writeback() 2010-08-09 16:47:49 -04:00
isofs fs/: do not fallback to default_llseek() when readdir() uses BKL 2010-05-27 09:12:56 -07:00
jbd ext3: Fix waiting on transaction during fsync 2010-05-21 19:30:41 +02:00
jbd2 jbd2/ocfs2: Fix block checksumming when a buffer is used in several transactions 2010-07-15 15:17:47 -07:00
jffs2 convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
jfs switch jfs to ->evict_inode() 2010-08-09 16:48:17 -04:00
lockd
logfs Make ->drop_inode() just return whether inode needs to be dropped 2010-08-09 16:48:35 -04:00
minix switch minix to ->evict_inode(), fix write_inode/delete_inode race 2010-08-09 16:47:53 -04:00
ncpfs switch ncpfs to ->evict_inode() 2010-08-09 16:48:20 -04:00
nfs convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
nfs_common
nfsd pass a struct path to vfs_statfs 2010-08-09 16:48:42 -04:00
nilfs2 convert nilfs2 to ->evict_inode() 2010-08-09 16:48:25 -04:00
nls
notify simplify checks for I_CLEAR/I_FREEING 2010-08-09 16:47:44 -04:00
ntfs convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
ocfs2 convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
omfs switch omfs to ->evict_inode() 2010-08-09 16:48:05 -04:00
openpromfs
partitions [S390] dasd: use correct label location for diag fba disks 2010-07-19 09:22:50 +02:00
proc switch procfs to ->evict_inode() 2010-08-09 16:47:52 -04:00
qnx4 get rid of cont_write_begin_newtrunc 2010-08-09 16:47:31 -04:00
quota simplify checks for I_CLEAR/I_FREEING 2010-08-09 16:47:44 -04:00
ramfs check ATTR_SIZE contraints in inode_change_ok 2010-08-09 16:47:39 -04:00
reiserfs convert reiserfs to ->evict_inode() 2010-08-09 16:48:23 -04:00
romfs
smbfs switch smbfs to evict_inode() 2010-08-09 16:48:00 -04:00
squashfs squashfs: fix name reading in squashfs_xattr_get 2010-05-23 08:27:42 +01:00
sysfs switch sysfs to ->evict_inode() 2010-08-09 16:47:53 -04:00
sysv sysv: do not mark superblock dirty on remount 2010-08-09 16:48:58 -04:00
ubifs switch ubifs to ->evict_inode() 2010-08-09 16:48:18 -04:00
udf switch udf to ->evict_inode() 2010-08-09 16:48:19 -04:00
ufs switch ufs to ->evict_inode() 2010-08-09 16:48:02 -04:00
xfs convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
aio.c get rid of the magic around f_count in aio 2010-05-27 22:03:07 -04:00
anon_inodes.c Revert "anon_inode: set S_IFREG on the anon_inode" 2010-05-27 22:03:05 -04:00
attr.c check ATTR_SIZE contraints in inode_change_ok 2010-08-09 16:47:39 -04:00
bad_inode.c drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
binfmt_aout.c
binfmt_elf_fdpic.c binfmt_elf_fdpic: Fix clear_user() error handling 2010-06-01 08:11:06 -07:00
binfmt_elf.c
binfmt_em86.c
binfmt_flat.c flat: tweak default stack alignment 2010-06-29 15:29:31 -07:00
binfmt_misc.c convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
binfmt_script.c
binfmt_som.c
bio-integrity.c
bio.c
block_dev.c convert remaining ->clear_inode() to ->evict_inode() 2010-08-09 16:48:37 -04:00
buffer.c get rid of block_write_begin_newtrunc 2010-08-09 16:47:33 -04:00
char_dev.c
compat_binfmt_elf.c
compat_ioctl.c
compat.c pass a struct path to vfs_statfs 2010-08-09 16:48:42 -04:00
dcache.c new helper: __dentry_path() 2010-08-09 16:48:13 -04:00
dcookies.c
direct-io.c sort out blockdev_direct_IO variants 2010-08-09 16:47:29 -04:00
drop_caches.c simplify checks for I_CLEAR/I_FREEING 2010-08-09 16:47:44 -04:00
eventfd.c
eventpoll.c
exec.c exit: avoid sig->count in de_thread/__exit_signal synchronization 2010-05-27 09:12:46 -07:00
fcntl.c fs/fcntl.c:kill_fasync_rcu() fa_lock must be IRQ-safe 2010-06-29 15:29:32 -07:00
fifo.c
file_table.c get rid of the magic around f_count in aio 2010-05-27 22:03:07 -04:00
file.c
filesystems.c
fs_struct.c
fs-writeback.c simplify checks for I_CLEAR/I_FREEING 2010-08-09 16:47:44 -04:00
generic_acl.c fs: xattr_handler table should be const 2010-05-21 18:31:18 -04:00
inode.c All filesystems that need invalidate_inode_buffers() are doing that explicitly 2010-08-09 16:48:39 -04:00
internal.h Bury __put_super_and_need_restart() 2010-05-21 18:31:16 -04:00
ioctl.c Introduce freeze_super and thaw_super for the fsfreeze ioctl 2010-05-21 18:31:18 -04:00
ioprio.c
Kconfig
Kconfig.binfmt
libfs.c check ATTR_SIZE contraints in inode_change_ok 2010-08-09 16:47:39 -04:00
locks.c
Makefile Take statfs variants to fs/statfs.c 2010-05-21 18:31:17 -04:00
mbcache.c mbcache: fix shrinker function return value 2010-08-09 16:48:47 -04:00
mpage.c
namei.c VFS: fix recent breakage of FS_REVAL_DOT 2010-05-27 22:03:06 -04:00
namespace.c
nfsctl.c
no-block.c
open.c Take statfs variants to fs/statfs.c 2010-05-21 18:31:17 -04:00
pipe.c pipe: fix check in "set size" fcntl 2010-06-10 19:08:34 +02:00
pnode.c
pnode.h
posix_acl.c
read_write.c vfs: introduce noop_llseek() 2010-05-27 09:12:56 -07:00
read_write.h
readdir.c
select.c
seq_file.c
signalfd.c
splice.c splice: check f_mode for seekable file 2010-06-30 08:12:37 +02:00
stack.c
stat.c
statfs.c add f_flags to struct statfs(64) 2010-08-09 16:48:44 -04:00
super.c vfs: don't hold s_umount over close_bdev_exclusive() call 2010-08-09 16:48:59 -04:00
sync.c get rid of file_fsync() 2010-08-09 16:47:43 -04:00
timerfd.c fs/timerfd.c: make use of wait_event_interruptible_locked_irq() 2010-05-20 13:21:42 -07:00
utimes.c
xattr_acl.c
xattr.c fs: xattr_handler table should be const 2010-05-21 18:31:18 -04:00