[S390] cio: ensure proper locking during device recognition
authorPeter Oberparleiter <peter.oberparleiter@de.ibm.com>
Mon, 7 Dec 2009 11:51:23 +0000 (12:51 +0100)
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>
Mon, 7 Dec 2009 11:51:30 +0000 (12:51 +0100)
Device recognition needs to be started with the ccw device lock
held to prevent race conditions between I/O starting and interrupt
reception.

Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/cio/device.c

index 7ad6bfb..afa362c 100644 (file)
@@ -488,7 +488,9 @@ static int online_store_recog_and_online(struct ccw_device *cdev)
 {
        /* Do device recognition, if needed. */
        if (cdev->private->state == DEV_STATE_BOXED) {
+               spin_lock_irq(cdev->ccwlock);
                ccw_device_recognition(cdev);
+               spin_unlock_irq(cdev->ccwlock);
                wait_event(cdev->private->wait_q,
                           cdev->private->flags.recog_done);
                if (cdev->private->state != DEV_STATE_OFFLINE)