]> git.itanic.dy.fi Git - linux-stable/commit
s390/dasd: fix incorrect locking order for LCU device add/remove
authorStefan Haberland <stefan.haberland@de.ibm.com>
Tue, 15 Dec 2015 10:00:51 +0000 (11:00 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 23 Feb 2016 07:56:19 +0000 (08:56 +0100)
commit9bfefde718c1352d9499125bce50b2a0e8a3db4c
tree9e216312c5a71c968214d54b6f77454be9c13c49
parent1f021ea0da3bc499387d87e31aeb1e36d2db052b
s390/dasd: fix incorrect locking order for LCU device add/remove

The correct lock order for LCU lock and cdev lock is to take the cdev
lock first and afterwards the LCU lock. This is caused by the fact
that LCU functions are called in an interrupt context with the cdev
lock implicitly hold by CIO.

To assure the right locking order but also be able to iterate over
devices in a LCU introduce a trylock block that can be called with
the device lock for one device hold and then takes the LCU lock and
try to lock all devices accounted to this LCU. Afterwards all devices
and the LCU itself are locked.

Signed-off-by: Stefan Haberland <stefan.haberland@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/block/dasd_alias.c