Files
mirror_zfs/module/zfs
Brian Behlendorf 65d56083b4 Fix zpool on zvol lock inversion deadlock
In all but one case the spa_namespace_lock is taken before the
bdev->bd_mutex lock.  But Linux __blkdev_get() function calls
fops->open() with the bdev->bd_mutex lock held and we must
somehow still safely acquire the spa_namespace_lock.

To avoid a potential lock inversion deadlock we preemptively
try to take the spa_namespace_lock().  Normally it will not
be contended and this is safe because spa_open_common() handles
the case where the caller already holds the spa_namespace_lock.

When it is contended we risk a lock inversion if we were to
block waiting for the lock.  Luckily, the __blkdev_get()
function allows us to return -ERESTARTSYS which will result in
bdev->bd_mutex being dropped, reacquired, and fops->open() being
called again.  This process can be repeated safely until both
locks are acquired.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Closes #612
2012-12-20 09:57:39 -08:00
..
2012-10-12 10:03:03 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-10-29 08:57:45 -07:00
2010-08-26 14:24:34 -07:00
2010-08-31 13:41:58 -07:00
2012-10-08 10:19:05 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-11-09 12:24:51 -08:00
2010-08-31 08:38:45 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-11-02 15:45:56 -07:00
2012-09-17 11:22:23 -07:00
2010-08-31 13:41:58 -07:00
2012-10-15 16:01:54 -07:00
2010-08-31 08:38:46 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2010-12-07 16:05:25 -08:00
2012-08-27 12:01:37 -07:00
2010-08-31 13:41:59 -07:00
2010-08-31 13:41:58 -07:00
2012-08-27 12:01:37 -07:00
2010-08-31 13:41:58 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-11-30 13:48:17 -08:00
2012-08-27 12:01:37 -07:00
2012-11-02 15:45:56 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-08-27 12:01:37 -07:00
2012-12-18 11:02:28 -08:00
2012-09-05 08:44:58 -07:00
2012-09-05 08:44:58 -07:00
2012-08-27 12:01:37 -07:00
2010-08-31 13:41:58 -07:00
2012-02-09 16:37:48 -08:00
2012-12-05 13:41:30 -08:00
2011-03-02 11:44:34 -08:00
2012-12-20 09:56:28 -08:00
2010-08-31 13:41:50 -07:00
2012-09-17 11:06:58 -07:00
2012-12-10 09:44:45 -08:00
2011-05-04 10:02:37 -07:00
2010-09-17 16:24:15 -07:00