]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
scsi: use REQ_TYPE_FS for flush request
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Fri, 9 Jul 2010 00:38:26 +0000 (09:38 +0900)
committerJens Axboe <jaxboe@fusionio.com>
Sat, 7 Aug 2010 16:52:41 +0000 (18:52 +0200)
scsi-ml uses REQ_TYPE_BLOCK_PC for flush requests from file
systems. The definition of REQ_TYPE_BLOCK_PC is that we don't retry
requests even when we can (e.g. UNIT ATTENTION) and we send the
response to the callers (then the callers can decide what they want).
We need a workaround such as the commit
77a4229719e511a0d38d9c355317ae1469adeb54 to retry BLOCK_PC flush
requests. We will need the similar workaround for discard requests too
since SCSI-ml handle them as BLOCK_PC internally.

This uses REQ_TYPE_FS for flush requests from file systems instead of
REQ_TYPE_BLOCK_PC.

scsi-ml retries only REQ_TYPE_FS requests that have data to
transfer when we can retry them (e.g. UNIT_ATTENTION). However, we
also need to retry REQ_TYPE_FS requests without data because the
callers don't.

This also changes scsi_check_sense() to retry all the REQ_TYPE_FS
requests when appropriate. Thanks to scsi_noretry_cmd(),
REQ_TYPE_BLOCK_PC requests don't be retried as before.

Note that basically, this reverts the commit
77a4229719e511a0d38d9c355317ae1469adeb54 since now we use REQ_TYPE_FS
for flush requests.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
drivers/scsi/scsi_error.c
drivers/scsi/sd.c

index 1b88af89d0c7fece1ea2f67874a1125c9b375b02..2768bf6ffe59e0e799036b7101bea5923e993c7e 100644 (file)
@@ -307,20 +307,7 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
                    (sshdr.asc == 0x04) && (sshdr.ascq == 0x02))
                        return FAILED;
 
-               if (scmd->request->cmd_flags & REQ_HARDBARRIER)
-                       /*
-                        * barrier requests should always retry on UA
-                        * otherwise block will get a spurious error
-                        */
-                       return NEEDS_RETRY;
-               else
-                       /*
-                        * for normal (non barrier) commands, pass the
-                        * UA upwards for a determination in the
-                        * completion functions
-                        */
-                       return SUCCESS;
-
+               return NEEDS_RETRY;
                /* these three are not supported */
        case COPY_ABORTED:
        case VOLUME_OVERFLOW:
@@ -1336,7 +1323,9 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd)
                 * assume caller has checked sense and determinted
                 * the check condition was retryable.
                 */
-               return (scmd->request->cmd_flags & REQ_FAILFAST_DEV);
+               if (scmd->request->cmd_flags & REQ_FAILFAST_DEV ||
+                   scmd->request->cmd_type == REQ_TYPE_BLOCK_PC)
+                       return 1;
        }
 
        return 0;
index e63b85ac8cd12453c8deeb22081807571999f831..108daead7ae8abcc2dc1962615ab4b62628b9f6d 100644 (file)
@@ -477,8 +477,6 @@ static int scsi_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq)
 
 static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq)
 {
-       /* for now, we use REQ_TYPE_BLOCK_PC. */
-       rq->cmd_type = REQ_TYPE_BLOCK_PC;
        rq->timeout = SD_TIMEOUT;
        rq->retries = SD_MAX_RETRIES;
        rq->cmd[0] = SYNCHRONIZE_CACHE;