All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: Oliver Neukum <oliver@neukum.org>
Cc: JBottomley@parallels.com, linux-scsi@vger.kernel.org,
	hare@suse.de, Oliver Neukum <oneukum@suse.de>
Subject: Re: [PATCH 3/3] sd: error handling synchronizing caches
Date: Wed, 01 Aug 2012 11:35:36 -0500	[thread overview]
Message-ID: <50195AD8.2090803@cs.wisc.edu> (raw)
In-Reply-To: <1343832250-24228-4-git-send-email-oliver@neukum.org>

> 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()?



      parent reply	other threads:[~2012-08-01 16:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01 14:44 cleanup error handling during suspend/resume of sd Oliver Neukum
2012-08-01 14:44 ` [PATCH 1/3] sd: SCSI error codes must not be returned to generic code Oliver Neukum
2012-08-01 14:44 ` [PATCH 2/3] sd: handle errors in sd_start_stop_device() Oliver Neukum
2012-08-01 14:44 ` [PATCH 3/3] sd: error handling synchronizing caches Oliver Neukum
2012-08-01 15:20   ` James Bottomley
2012-08-01 16:35   ` Mike Christie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50195AD8.2090803@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=JBottomley@parallels.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=oliver@neukum.org \
    --cc=oneukum@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.