• Stefan Haberland's avatar
    s390/dasd: reorder lcu and device lock · 59a9ed5f
    Stefan Haberland authored
    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: default avatarStefan Haberland <sth@linux.vnet.ibm.com>
    Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    59a9ed5f
dasd_eckd.h 12.7 KB