]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
[S390] dasd: forward internal errors to dasd_sleep_on caller
authorStefan Weinhuber <wein@de.ibm.com>
Fri, 12 Jun 2009 08:26:39 +0000 (10:26 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 12 Jun 2009 08:27:36 +0000 (10:27 +0200)
If a DASD requests is started with dasd_sleep_on and fails, then the
calling function may need to know the reason for the failure.
In cases of hardware errors it can inspect the sense data in the irb,
but when the reason is internal (e.g. start_IO failed) then it needs
a meaningfull return code.

Signed-off-by: Stefan Weinhuber <wein@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/block/dasd.c
drivers/s390/block/dasd_diag.c
drivers/s390/block/dasd_eckd.c
drivers/s390/block/dasd_int.h

index 35f43bea5d07cf0ec853e02dd5e07efda2582728..442bb98a2821c5a34519b08e452bfb9ffa1bf629 100644 (file)
@@ -851,8 +851,10 @@ int dasd_start_IO(struct dasd_ccw_req *cqr)
 
        /* Check the cqr */
        rc = dasd_check_cqr(cqr);
-       if (rc)
+       if (rc) {
+               cqr->intrc = rc;
                return rc;
+       }
        device = (struct dasd_device *) cqr->startdev;
        if (cqr->retries < 0) {
                /* internal error 14 - start_IO run out of retries */
@@ -915,6 +917,7 @@ int dasd_start_IO(struct dasd_ccw_req *cqr)
                BUG();
                break;
        }
+       cqr->intrc = rc;
        return rc;
 }
 
@@ -1454,8 +1457,12 @@ int dasd_sleep_on(struct dasd_ccw_req *cqr)
        dasd_add_request_tail(cqr);
        wait_event(generic_waitq, _wait_for_wakeup(cqr));
 
-       /* Request status is either done or failed. */
-       rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO;
+       if (cqr->status == DASD_CQR_DONE)
+               rc = 0;
+       else if (cqr->intrc)
+               rc = cqr->intrc;
+       else
+               rc = -EIO;
        return rc;
 }
 
@@ -1477,8 +1484,15 @@ int dasd_sleep_on_interruptible(struct dasd_ccw_req *cqr)
                dasd_cancel_req(cqr);
                /* wait (non-interruptible) for final status */
                wait_event(generic_waitq, _wait_for_wakeup(cqr));
+               cqr->intrc = rc;
        }
-       rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO;
+
+       if (cqr->status == DASD_CQR_DONE)
+               rc = 0;
+       else if (cqr->intrc)
+               rc = cqr->intrc;
+       else
+               rc = -EIO;
        return rc;
 }
 
@@ -1523,8 +1537,12 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
 
        wait_event(generic_waitq, _wait_for_wakeup(cqr));
 
-       /* Request status is either done or failed. */
-       rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO;
+       if (cqr->status == DASD_CQR_DONE)
+               rc = 0;
+       else if (cqr->intrc)
+               rc = cqr->intrc;
+       else
+               rc = -EIO;
        return rc;
 }
 
index 2efaddfae56088be5d25bf27e4f53991105ec070..644086ba2ede9365e0733964855e41c992e6f2a5 100644 (file)
@@ -202,6 +202,7 @@ dasd_start_diag(struct dasd_ccw_req * cqr)
                rc = -EIO;
                break;
        }
+       cqr->intrc = rc;
        return rc;
 }
 
index 216c09bcd222409fd46fa2f9195e07d078e0ed12..cf0cfdba1244bb95891955820f6e873b24bdb6c7 100644 (file)
@@ -3017,8 +3017,9 @@ static void dasd_eckd_dump_sense_ccw(struct dasd_device *device,
                      " I/O status report for device %s:\n",
                      dev_name(&device->cdev->dev));
        len += sprintf(page + len, KERN_ERR PRINTK_HEADER
-                      " in req: %p CS: 0x%02X DS: 0x%02X\n", req,
-                      scsw_cstat(&irb->scsw), scsw_dstat(&irb->scsw));
+                      " in req: %p CS: 0x%02X DS: 0x%02X CC: 0x%02X RC: %d\n",
+                      req, scsw_cstat(&irb->scsw), scsw_dstat(&irb->scsw),
+                      scsw_cc(&irb->scsw), req->intrc);
        len += sprintf(page + len, KERN_ERR PRINTK_HEADER
                       " device %s: Failing CCW: %p\n",
                       dev_name(&device->cdev->dev),
@@ -3119,9 +3120,10 @@ static void dasd_eckd_dump_sense_tcw(struct dasd_device *device,
                      " I/O status report for device %s:\n",
                      dev_name(&device->cdev->dev));
        len += sprintf(page + len, KERN_ERR PRINTK_HEADER
-                      " in req: %p CS: 0x%02X DS: 0x%02X "
+                      " in req: %p CS: 0x%02X DS: 0x%02X CC: 0x%02X RC: %d "
                       "fcxs: 0x%02X schxs: 0x%02X\n", req,
                       scsw_cstat(&irb->scsw), scsw_dstat(&irb->scsw),
+                      scsw_cc(&irb->scsw), req->intrc,
                       irb->scsw.tm.fcxs, irb->scsw.tm.schxs);
        len += sprintf(page + len, KERN_ERR PRINTK_HEADER
                       " device %s: Failing TCW: %p\n",
index 3ab69b5a41f62b34944f9949885549fb1a999de8..f97ceb795078ee9c1cb0df2bba09c0755575dc9f 100644 (file)
@@ -173,6 +173,7 @@ struct dasd_ccw_req {
        void *data;                     /* pointer to data area */
 
        /* these are important for recovering erroneous requests          */
+       int intrc;                      /* internal error, e.g. from start_IO */
        struct irb irb;                 /* device status in case of an error */
        struct dasd_ccw_req *refers;    /* ERP-chain queueing. */
        void *function;                 /* originating ERP action */