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
..
2010-05-27 09:12:41 -07:00
2010-08-09 16:48:53 -04:00
2010-08-09 16:48:55 -04:00
2010-08-09 16:48:48 -04:00
2010-08-09 16:47:51 -04:00
2010-05-19 22:41:57 -04:00
2010-08-09 16:48:42 -04:00
2010-08-09 16:48:24 -04:00
2010-08-09 16:48:45 -04:00
2010-08-09 16:48:45 -04:00
2010-08-09 16:48:45 -04:00
2010-08-09 16:48:01 -04:00
2010-08-09 16:48:17 -04:00
2010-08-09 16:48:16 -04:00
2010-08-09 16:47:49 -04:00
2010-08-09 16:48:17 -04:00
2010-08-09 16:48:20 -04:00
2010-08-09 16:48:42 -04:00
2010-08-09 16:48:25 -04:00
2010-08-09 16:48:05 -04:00
2010-08-09 16:47:52 -04:00
2010-08-09 16:47:31 -04:00
2010-08-09 16:48:00 -04:00
2010-08-09 16:47:53 -04:00
2010-08-09 16:48:18 -04:00
2010-08-09 16:48:19 -04:00
2010-08-09 16:48:02 -04:00
2010-08-09 16:47:33 -04:00
2010-08-09 16:48:42 -04:00
2010-08-09 16:48:13 -04:00
2010-05-21 18:31:16 -04:00
2010-05-21 18:31:17 -04:00
2010-05-21 18:31:17 -04:00
2010-06-10 19:08:34 +02:00
2010-05-27 09:12:56 -07:00
2010-08-09 16:48:44 -04:00
2010-08-09 16:47:43 -04:00