> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index a344220..49b0c52 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -1278,8 +1278,32 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
>  
>       if (res) {
>               sd_print_result(sdkp, res);
> +
>               if (driver_byte(res) & DRIVER_SENSE)
>                       sd_print_sense_hdr(sdkp, &sshdr);
> +                     /* we need to evaluate the error return  */
> +                     if ((scsi_sense_valid(&sshdr) &&
> +                             /* 0x3a is medium not present */
> +                             sshdr.asc == 0x3a))
> +                                     /* this is no error here */
> +                                     return 0;
> +
> +                     switch (host_byte(res)) {
> +                     /* ignore errors due to racing a disconnection */
> +                     case DID_BAD_TARGET:
> +                     case DID_NO_CONNECT:
> +                             return 0;
> +                     /* signal the upper layer it might try again */
> +                     case DID_BUS_BUSY:
> +                     case DID_IMM_RETRY:
> +                     case DID_REQUEUE:
> +                     case DID_SOFT_ERROR:
> +                             return -EBUSY;
> +                     default:
> +                             return -EIO;

Could we have all the host/scsi-ml to -EXYZ error conversions put in one
place like __scsi_error_from_host_byte()?


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to