]> git.itanic.dy.fi Git - linux-stable/commit
s390/dasd: reorder lcu and device lock
authorStefan Haberland <sth@linux.vnet.ibm.com>
Tue, 23 Feb 2016 09:15:27 +0000 (10:15 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 17 Mar 2016 12:18:25 +0000 (13:18 +0100)
commit59a9ed5f87b6e396aed1f6bf7d6496f7ba66c37a
treea007b19d3731854629ac5985fc56239ea4f5716e
parent1e3c1dd15dd30232458e35128fd062b788b1c9e4
s390/dasd: reorder lcu and device lock

Reorder lcu and device lock to get rid of the error-prone trylock
mechanism.

The locking order is lcu lock -> device lock.
This protects against changes to the lcu device lists and enables us
to iterate over the devices, take the cdev lock and make changes to
the device structures.

The complicated part is the summary unit check handler that gets an
interrupt on one device of the lcu that leads to structural changes of
the whole lcu itself. This work needs to be done even if devices on
the lcu disappear. So a device independent worker is used.
The old approach tried to update some lcu structures and set up the
lcu worker in the interrupt context with the device lock held.
But this forced the lock order "cdev lock -> lcu lock" that made it
hard to have the lcu lock held and iterate over all devices and change
them.

The new approach is to schedule a device specific worker that gets
out of the interrupt context and rid of the device lock for summary
unit checks. This worker is able to take the lcu lock and schedule the
lcu worker that updates all devices. The time between interrupt and
worker execution is no problem because the devices in the lcu reject
all I/O in this time with an appropriate error. The dasd driver can
deal with this situation and re-drive the I/O later on.

Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/block/dasd_alias.c
drivers/s390/block/dasd_eckd.c
drivers/s390/block/dasd_eckd.h
drivers/s390/block/dasd_int.h