Commit e96f6abe02fc3320d669985443e8c68ff8e83294

Authored by FUJITA Tomonori
Committed by Jens Axboe
1 parent 16f2319fd6

scsi: use REQ_TYPE_FS for flush request

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>

Showing 2 changed files with 4 additions and 17 deletions Side-by-side Diff

drivers/scsi/scsi_error.c
... ... @@ -307,20 +307,7 @@
307 307 (sshdr.asc == 0x04) && (sshdr.ascq == 0x02))
308 308 return FAILED;
309 309  
310   - if (scmd->request->cmd_flags & REQ_HARDBARRIER)
311   - /*
312   - * barrier requests should always retry on UA
313   - * otherwise block will get a spurious error
314   - */
315   - return NEEDS_RETRY;
316   - else
317   - /*
318   - * for normal (non barrier) commands, pass the
319   - * UA upwards for a determination in the
320   - * completion functions
321   - */
322   - return SUCCESS;
323   -
  310 + return NEEDS_RETRY;
324 311 /* these three are not supported */
325 312 case COPY_ABORTED:
326 313 case VOLUME_OVERFLOW:
... ... @@ -1336,7 +1323,9 @@
1336 1323 * assume caller has checked sense and determinted
1337 1324 * the check condition was retryable.
1338 1325 */
1339   - return (scmd->request->cmd_flags & REQ_FAILFAST_DEV);
  1326 + if (scmd->request->cmd_flags & REQ_FAILFAST_DEV ||
  1327 + scmd->request->cmd_type == REQ_TYPE_BLOCK_PC)
  1328 + return 1;
1340 1329 }
1341 1330  
1342 1331 return 0;
... ... @@ -477,8 +477,6 @@
477 477  
478 478 static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq)
479 479 {
480   - /* for now, we use REQ_TYPE_BLOCK_PC. */
481   - rq->cmd_type = REQ_TYPE_BLOCK_PC;
482 480 rq->timeout = SD_TIMEOUT;
483 481 rq->retries = SD_MAX_RETRIES;
484 482 rq->cmd[0] = SYNCHRONIZE_CACHE;