[PATCH] s390: dasd ioctl never returns
authorHorst Hummel <horst.hummel@de.ibm.com>
Fri, 28 Apr 2006 01:40:10 +0000 (18:40 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 28 Apr 2006 15:33:48 +0000 (08:33 -0700)
The dasd state machine is not designed to enable an unformatted device, since
'unformatted' is a final state.  The BIODASDENABLE ioctl calls
dasd_enable_device() which never returns if the device is in this special
state.  Return -EPERM in dasd_increase_state for unformatted devices to make
dasd_enable_device terminate.  Note: To get such an unformatted device online
it has to be re-analyzed.  This means that the device needs to be disabled
prior to re-enablement.

Signed-off-by: Horst Hummel <horst.hummel@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/s390/block/dasd.c

index a3bfebcf31efeb72f3a6de690d82f412eaa5218b..cfb1fff3787caafd63fe05a2c36587bfdb8f19a5 100644 (file)
@@ -314,6 +314,11 @@ dasd_increase_state(struct dasd_device *device)
            device->target >= DASD_STATE_READY)
                rc = dasd_state_basic_to_ready(device);
 
+       if (!rc &&
+           device->state == DASD_STATE_UNFMT &&
+           device->target > DASD_STATE_UNFMT)
+               rc = -EPERM;
+
        if (!rc &&
            device->state == DASD_STATE_READY &&
            device->target >= DASD_STATE_ONLINE)