From 39ccf95e28765a08a9e01be614695d7c570b4e77 Mon Sep 17 00:00:00 2001 From: Horst Hummel Date: Thu, 27 Apr 2006 18:40:10 -0700 Subject: [PATCH] [PATCH] s390: dasd ioctl never returns 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 Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/block/dasd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index a3bfebcf31ef..cfb1fff3787c 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -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) -- GitLab