linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@sandisk.com>
To: Hannes Reinecke <hare@suse.de>,
	James Bottomley <james.bottomley@hansenpartnership.com>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-scsi@vger.kernel.org, Ewan Milne <emilne@redhat.com>
Subject: Re: [PATCH] scsi: retry MODE SENSE on unit attention
Date: Mon, 6 Jul 2015 08:19:07 -0700	[thread overview]
Message-ID: <559A9C6B.7060908@sandisk.com> (raw)
In-Reply-To: <1436181409-83358-1-git-send-email-hare@suse.de>

On 07/06/2015 04:16 AM, Hannes Reinecke wrote:
> The 'sd' driver is calling scsi_mode_sense() to figure out
> internal details. But scsi_mode_sense() never checks for
> any pending unit attentions, leading to incorrect decisions
> during probing.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Reviewed-by: Ewan Milne <emilne@redhat.com>
> ---
>   drivers/scsi/scsi_lib.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index b1a2631..4f3c120 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -2423,7 +2423,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
>   	unsigned char cmd[12];
>   	int use_10_for_ms;
>   	int header_length;
> -	int result;
> +	int result, retry_count = retries;
>   	struct scsi_sense_hdr my_sshdr;
>
>   	memset(data, 0, sizeof(*data));
> @@ -2502,6 +2502,11 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
>   			data->block_descriptor_length = buffer[3];
>   		}
>   		data->header_length = header_length;
> +	} else if ((status_byte(result) == CHECK_CONDITION) &&
> +		   scsi_sense_valid(sshdr) &&
> +		   sshdr->sense_key == UNIT_ATTENTION && retry_count) {
> +		retry_count--;
> +		goto retry;
>   	}
>
>   	return result;

Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>

  reply	other threads:[~2015-07-06 15:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 11:16 [PATCH] scsi: retry MODE SENSE on unit attention Hannes Reinecke
2015-07-06 15:19 ` Bart Van Assche [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-06-12 14:12 Hannes Reinecke
2015-06-11 11:01 Hannes Reinecke
2015-06-11 15:07 ` Ewan Milne
2015-06-12  6:27   ` Hannes Reinecke
2015-06-12 14:08     ` Ewan Milne

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=559A9C6B.7060908@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=emilne@redhat.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).