diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2009-03-31 13:16:03 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-03-31 13:17:03 -0400 |
commit | 156013ffd1225ef862853a4340b46f76845f8db1 (patch) | |
tree | 0e6b202a111a483b9f44961508b3694dc0022df9 | |
parent | 33b26d7951619e4debf3a82f30a03423a36a1412 (diff) |
[S390] cio: wake up on failed recognition
Wake up even on failed device recognition, since this may be triggered
from a user trying to force a device online. With this patch a write
to the online sysfs attribute will not block for ever but return with
-EAGAIN in this case.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | drivers/s390/cio/device.c | 10 | ||||
-rw-r--r-- | drivers/s390/cio/device_fsm.c | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index c4d2f667a2f6..9f016fef6101 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -482,17 +482,21 @@ static int online_store_recog_and_online(struct ccw_device *cdev) | |||
482 | } | 482 | } |
483 | wait_event(cdev->private->wait_q, | 483 | wait_event(cdev->private->wait_q, |
484 | cdev->private->flags.recog_done); | 484 | cdev->private->flags.recog_done); |
485 | if (cdev->private->state != DEV_STATE_OFFLINE) | ||
486 | /* recognition failed */ | ||
487 | return -EAGAIN; | ||
485 | } | 488 | } |
486 | if (cdev->drv && cdev->drv->set_online) | 489 | if (cdev->drv && cdev->drv->set_online) |
487 | ccw_device_set_online(cdev); | 490 | ccw_device_set_online(cdev); |
488 | return 0; | 491 | return 0; |
489 | } | 492 | } |
493 | |||
490 | static int online_store_handle_online(struct ccw_device *cdev, int force) | 494 | static int online_store_handle_online(struct ccw_device *cdev, int force) |
491 | { | 495 | { |
492 | int ret; | 496 | int ret; |
493 | 497 | ||
494 | ret = online_store_recog_and_online(cdev); | 498 | ret = online_store_recog_and_online(cdev); |
495 | if (ret) | 499 | if (ret && !force) |
496 | return ret; | 500 | return ret; |
497 | if (force && cdev->private->state == DEV_STATE_BOXED) { | 501 | if (force && cdev->private->state == DEV_STATE_BOXED) { |
498 | ret = ccw_device_stlck(cdev); | 502 | ret = ccw_device_stlck(cdev); |
@@ -500,7 +504,9 @@ static int online_store_handle_online(struct ccw_device *cdev, int force) | |||
500 | return ret; | 504 | return ret; |
501 | if (cdev->id.cu_type == 0) | 505 | if (cdev->id.cu_type == 0) |
502 | cdev->private->state = DEV_STATE_NOT_OPER; | 506 | cdev->private->state = DEV_STATE_NOT_OPER; |
503 | online_store_recog_and_online(cdev); | 507 | ret = online_store_recog_and_online(cdev); |
508 | if (ret) | ||
509 | return ret; | ||
504 | } | 510 | } |
505 | return 0; | 511 | return 0; |
506 | } | 512 | } |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 87b4bfca080f..ccd72f95765f 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -260,6 +260,7 @@ ccw_device_recog_done(struct ccw_device *cdev, int state) | |||
260 | if (state == DEV_STATE_NOT_OPER) { | 260 | if (state == DEV_STATE_NOT_OPER) { |
261 | cdev->private->flags.recog_done = 1; | 261 | cdev->private->flags.recog_done = 1; |
262 | cdev->private->state = DEV_STATE_DISCONNECTED; | 262 | cdev->private->state = DEV_STATE_DISCONNECTED; |
263 | wake_up(&cdev->private->wait_q); | ||
263 | return; | 264 | return; |
264 | } | 265 | } |
265 | /* Boxed devices don't need extra treatment. */ | 266 | /* Boxed devices don't need extra treatment. */ |
@@ -311,8 +312,7 @@ ccw_device_recog_done(struct ccw_device *cdev, int state) | |||
311 | } | 312 | } |
312 | cdev->private->state = state; | 313 | cdev->private->state = state; |
313 | io_subchannel_recog_done(cdev); | 314 | io_subchannel_recog_done(cdev); |
314 | if (state != DEV_STATE_NOT_OPER) | 315 | wake_up(&cdev->private->wait_q); |
315 | wake_up(&cdev->private->wait_q); | ||
316 | } | 316 | } |
317 | 317 | ||
318 | /* | 318 | /* |