[patch 34/52] [PATCH] cio: ensure proper locking during device recognition

Martin Schwidefsky
2009-11-13T15:11:56Z

[-- Attachment #1: 133-cio-recognition-locking.diff --]
[-- Type: text/plain, Size: 1018 bytes --]

From: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>

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 | 2 ++
1 file changed, 2 insertions(+)

Index: quilt-2.6/drivers/s390/cio/device.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/device.c 2009-11-13 16:08:18.000000000 +0100
+++ quilt-2.6/drivers/s390/cio/device.c 2009-11-13 16:08:19.000000000 +0100
@@ -488,7 +488,9 @@
{
/* 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)