All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [SCSI] scsi_lib: fix scsi_io_completion's SG_IO error propagation
@ 2012-05-31 19:05 Mike Snitzer
  2012-05-31 19:51 ` Paolo Bonzini
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Snitzer @ 2012-05-31 19:05 UTC (permalink / raw)
  To: linux-scsi
  Cc: babu.moger, hare, michaelc, James.Bottomley, Mike Snitzer, stable

The following v3.4-rc1 commit unmasked an existing bug in
scsi_io_completion's SG_IO error handling:
47ac56d [SCSI] scsi_error: classify some ILLEGAL_REQUEST sense as a permanent TARGET_ERROR

Given that certain ILLEGAL_REQUEST are now properly categorized as
TARGET_ERROR the host_byte is being set (before host_byte wasn't ever
set for these ILLEGAL_REQUEST).

In scsi_io_completion, initialize req->errors with cmd->result _after_
the SG_IO block that calls __scsi_error_from_host_byte (which may
modify the host_byte).

Before this fix:

    cdb to send: 12 01 01 00 00 00
ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
    mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
    status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
    00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10,
    driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
SCSI Status: Check Condition

Sense Information:
sense buffer empty

After:

    cdb to send: 12 01 01 00 00 00
ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
    mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
    status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
    00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0,
    driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
SCSI Status: Check Condition

Sense Information:
 Fixed format, current;  Sense key: Illegal Request
 Additional sense: Invalid field in cdb
 Raw sense data (in hex):
        70 00 05 00 00 00 00 0b  00 00 00 00 24 00 00 00
        00 00 00

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Reviewed-by: Babu Moger <babu.moger@netapp.com>
Cc: stable@vger.kernel.org # 3.4
---
 drivers/scsi/scsi_lib.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 5dfd749..8db7ef0 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -753,7 +753,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 	}
 
 	if (req->cmd_type == REQ_TYPE_BLOCK_PC) { /* SG_IO ioctl from block level */
-		req->errors = result;
 		if (result) {
 			if (sense_valid && req->sense) {
 				/*
@@ -769,6 +768,10 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 			if (!sense_deferred)
 				error = __scsi_error_from_host_byte(cmd, result);
 		}
+		/*
+		 * __scsi_error_from_host_byte may have reset the host_byte
+		 */
+		req->errors = cmd->result;
 
 		req->resid_len = scsi_get_resid(cmd);
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] [SCSI] scsi_lib: fix scsi_io_completion's SG_IO error propagation
  2012-05-31 19:05 [PATCH] [SCSI] scsi_lib: fix scsi_io_completion's SG_IO error propagation Mike Snitzer
@ 2012-05-31 19:51 ` Paolo Bonzini
  2012-05-31 20:24   ` Mike Snitzer
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2012-05-31 19:51 UTC (permalink / raw)
  To: Mike Snitzer
  Cc: linux-scsi, babu.moger, hare, michaelc, James.Bottomley, stable

Il 31/05/2012 21:05, Mike Snitzer ha scritto:
> The following v3.4-rc1 commit unmasked an existing bug in
> scsi_io_completion's SG_IO error handling:
> 47ac56d [SCSI] scsi_error: classify some ILLEGAL_REQUEST sense as a permanent TARGET_ERROR
> 
> Given that certain ILLEGAL_REQUEST are now properly categorized as
> TARGET_ERROR the host_byte is being set (before host_byte wasn't ever
> set for these ILLEGAL_REQUEST).
> 
> In scsi_io_completion, initialize req->errors with cmd->result _after_
> the SG_IO block that calls __scsi_error_from_host_byte (which may
> modify the host_byte).
> 
> Before this fix:
> 
>     cdb to send: 12 01 01 00 00 00
> ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
>     mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
>     status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
>     00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10,
>     driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
> SCSI Status: Check Condition
> 
> Sense Information:
> sense buffer empty
> 
> After:
> 
>     cdb to send: 12 01 01 00 00 00
> ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
>     mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
>     status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
>     00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0,
>     driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
> SCSI Status: Check Condition
> 
> Sense Information:
>  Fixed format, current;  Sense key: Illegal Request
>  Additional sense: Invalid field in cdb
>  Raw sense data (in hex):
>         70 00 05 00 00 00 00 0b  00 00 00 00 24 00 00 00
>         00 00 00
> 
> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> Reviewed-by: Babu Moger <babu.moger@netapp.com>

Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

> Cc: stable@vger.kernel.org # 3.4
> ---
>  drivers/scsi/scsi_lib.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 5dfd749..8db7ef0 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -753,7 +753,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
>  	}
>  
>  	if (req->cmd_type == REQ_TYPE_BLOCK_PC) { /* SG_IO ioctl from block level */
> -		req->errors = result;
>  		if (result) {
>  			if (sense_valid && req->sense) {
>  				/*
> @@ -769,6 +768,10 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
>  			if (!sense_deferred)
>  				error = __scsi_error_from_host_byte(cmd, result);
>  		}
> +		/*
> +		 * __scsi_error_from_host_byte may have reset the host_byte
> +		 */
> +		req->errors = cmd->result;
>  
>  		req->resid_len = scsi_get_resid(cmd);
>  


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: scsi_lib: fix scsi_io_completion's SG_IO error propagation
  2012-05-31 19:51 ` Paolo Bonzini
@ 2012-05-31 20:24   ` Mike Snitzer
  2012-05-31 20:33     ` Moger, Babu
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Snitzer @ 2012-05-31 20:24 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: linux-scsi, babu.moger, hare, michaelc, James.Bottomley, stable

On Thu, May 31 2012 at  3:51pm -0400,
Paolo Bonzini <pbonzini@redhat.com> wrote:

> Il 31/05/2012 21:05, Mike Snitzer ha scritto:
> > The following v3.4-rc1 commit unmasked an existing bug in
> > scsi_io_completion's SG_IO error handling:
> > 47ac56d [SCSI] scsi_error: classify some ILLEGAL_REQUEST sense as a permanent TARGET_ERROR
> > 
> > Given that certain ILLEGAL_REQUEST are now properly categorized as
> > TARGET_ERROR the host_byte is being set (before host_byte wasn't ever
> > set for these ILLEGAL_REQUEST).
> > 
> > In scsi_io_completion, initialize req->errors with cmd->result _after_
> > the SG_IO block that calls __scsi_error_from_host_byte (which may
> > modify the host_byte).
> > 
> > Before this fix:
> > 
> >     cdb to send: 12 01 01 00 00 00
> > ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
> >     mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
> >     status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
> >     00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10,
> >     driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
> > SCSI Status: Check Condition
> > 
> > Sense Information:
> > sense buffer empty
> > 
> > After:
> > 
> >     cdb to send: 12 01 01 00 00 00
> > ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
> >     mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
> >     status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
> >     00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0,
> >     driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
> > SCSI Status: Check Condition
> > 
> > Sense Information:
> >  Fixed format, current;  Sense key: Illegal Request
> >  Additional sense: Invalid field in cdb
> >  Raw sense data (in hex):
> >         70 00 05 00 00 00 00 0b  00 00 00 00 24 00 00 00
> >         00 00 00
> > 
> > Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> > Reviewed-by: Babu Moger <babu.moger@netapp.com>
> 
> Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> Tested-by: Paolo Bonzini <pbonzini@redhat.com>

Yes, thanks for backfilling the Reported-by and Tested-by Paolo!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: scsi_lib: fix scsi_io_completion's SG_IO error propagation
  2012-05-31 20:24   ` Mike Snitzer
@ 2012-05-31 20:33     ` Moger, Babu
  2012-07-18 23:06       ` Mike Snitzer
  0 siblings, 1 reply; 7+ messages in thread
From: Moger, Babu @ 2012-05-31 20:33 UTC (permalink / raw)
  To: Mike Snitzer, Paolo Bonzini
  Cc: linux-scsi, hare, michaelc, James.Bottomley, stable

Thanks Mike. Looks good.

> -----Original Message-----
> From: Mike Snitzer [mailto:snitzer@redhat.com]
> Sent: Thursday, May 31, 2012 3:24 PM
> To: Paolo Bonzini
> Cc: linux-scsi@vger.kernel.org; Moger, Babu; hare@suse.de;
> michaelc@cs.wisc.edu; James.Bottomley@hansenpartnership.com;
> stable@vger.kernel.org.#.3.4
> Subject: Re: scsi_lib: fix scsi_io_completion's SG_IO error propagation
> 
> On Thu, May 31 2012 at  3:51pm -0400,
> Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
> > Il 31/05/2012 21:05, Mike Snitzer ha scritto:
> > > The following v3.4-rc1 commit unmasked an existing bug in
> > > scsi_io_completion's SG_IO error handling:
> > > 47ac56d [SCSI] scsi_error: classify some ILLEGAL_REQUEST sense as a
> permanent TARGET_ERROR
> > >
> > > Given that certain ILLEGAL_REQUEST are now properly categorized as
> > > TARGET_ERROR the host_byte is being set (before host_byte wasn't ever
> > > set for these ILLEGAL_REQUEST).
> > >
> > > In scsi_io_completion, initialize req->errors with cmd->result _after_
> > > the SG_IO block that calls __scsi_error_from_host_byte (which may
> > > modify the host_byte).
> > >
> > > Before this fix:
> > >
> > >     cdb to send: 12 01 01 00 00 00
> > > ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
> > >     mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
> > >     status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
> > >     00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10,
> > >     driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
> > > SCSI Status: Check Condition
> > >
> > > Sense Information:
> > > sense buffer empty
> > >
> > > After:
> > >
> > >     cdb to send: 12 01 01 00 00 00
> > > ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
> > >     mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
> > >     status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
> > >     00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0,
> > >     driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
> > > SCSI Status: Check Condition
> > >
> > > Sense Information:
> > >  Fixed format, current;  Sense key: Illegal Request
> > >  Additional sense: Invalid field in cdb
> > >  Raw sense data (in hex):
> > >         70 00 05 00 00 00 00 0b  00 00 00 00 24 00 00 00
> > >         00 00 00
> > >
> > > Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> > > Reviewed-by: Babu Moger <babu.moger@netapp.com>
> >
> > Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> > Tested-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> Yes, thanks for backfilling the Reported-by and Tested-by Paolo!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: scsi_lib: fix scsi_io_completion's SG_IO error propagation
  2012-05-31 20:33     ` Moger, Babu
@ 2012-07-18 23:06       ` Mike Snitzer
  2012-07-25 17:46         ` [RESEND PATCH] SCSI: " Mike Snitzer
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Snitzer @ 2012-07-18 23:06 UTC (permalink / raw)
  To: James.Bottomley; +Cc: Paolo Bonzini, linux-scsi, hare, michaelc, Moger, Babu

Hi James,

Seems this one slipped through the cracks.  Please review/apply.

Thanks,
Mike

On Thu, May 31 2012 at  4:33pm -0400,
Moger, Babu <Babu.Moger@netapp.com> wrote:

> Thanks Mike. Looks good.
> 
> > -----Original Message-----
> > From: Mike Snitzer [mailto:snitzer@redhat.com]
> > Sent: Thursday, May 31, 2012 3:24 PM
> > To: Paolo Bonzini
> > Cc: linux-scsi@vger.kernel.org; Moger, Babu; hare@suse.de;
> > michaelc@cs.wisc.edu; James.Bottomley@hansenpartnership.com;
> > stable@vger.kernel.org.#.3.4
> > Subject: Re: scsi_lib: fix scsi_io_completion's SG_IO error propagation
> > 
> > On Thu, May 31 2012 at  3:51pm -0400,
> > Paolo Bonzini <pbonzini@redhat.com> wrote:
> > 
> > > Il 31/05/2012 21:05, Mike Snitzer ha scritto:
> > > > The following v3.4-rc1 commit unmasked an existing bug in
> > > > scsi_io_completion's SG_IO error handling:
> > > > 47ac56d [SCSI] scsi_error: classify some ILLEGAL_REQUEST sense as a
> > permanent TARGET_ERROR
> > > >
> > > > Given that certain ILLEGAL_REQUEST are now properly categorized as
> > > > TARGET_ERROR the host_byte is being set (before host_byte wasn't ever
> > > > set for these ILLEGAL_REQUEST).
> > > >
> > > > In scsi_io_completion, initialize req->errors with cmd->result _after_
> > > > the SG_IO block that calls __scsi_error_from_host_byte (which may
> > > > modify the host_byte).
> > > >
> > > > Before this fix:
> > > >
> > > >     cdb to send: 12 01 01 00 00 00
> > > > ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
> > > >     mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
> > > >     status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
> > > >     00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10,
> > > >     driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
> > > > SCSI Status: Check Condition
> > > >
> > > > Sense Information:
> > > > sense buffer empty
> > > >
> > > > After:
> > > >
> > > >     cdb to send: 12 01 01 00 00 00
> > > > ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
> > > >     mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
> > > >     status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
> > > >     00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0,
> > > >     driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
> > > > SCSI Status: Check Condition
> > > >
> > > > Sense Information:
> > > >  Fixed format, current;  Sense key: Illegal Request
> > > >  Additional sense: Invalid field in cdb
> > > >  Raw sense data (in hex):
> > > >         70 00 05 00 00 00 00 0b  00 00 00 00 24 00 00 00
> > > >         00 00 00
> > > >
> > > > Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> > > > Reviewed-by: Babu Moger <babu.moger@netapp.com>
> > >
> > > Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> > > Tested-by: Paolo Bonzini <pbonzini@redhat.com>
> > 
> > Yes, thanks for backfilling the Reported-by and Tested-by Paolo!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [RESEND PATCH] SCSI: scsi_lib: fix scsi_io_completion's SG_IO error propagation
  2012-07-18 23:06       ` Mike Snitzer
@ 2012-07-25 17:46         ` Mike Snitzer
  2012-07-27 13:29           ` Hannes Reinecke
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Snitzer @ 2012-07-25 17:46 UTC (permalink / raw)
  To: James.Bottomley; +Cc: Paolo Bonzini, linux-scsi, hare, Babu.Moger

The following v3.4-rc1 commit unmasked an existing bug in
scsi_io_completion's SG_IO error handling:
47ac56d [SCSI] scsi_error: classify some ILLEGAL_REQUEST sense as a permanent TARGET_ERROR

Given that certain ILLEGAL_REQUEST are now properly categorized as
TARGET_ERROR the host_byte is being set (before host_byte wasn't ever
set for these ILLEGAL_REQUEST).

In scsi_io_completion, initialize req->errors with cmd->result _after_
the SG_IO block that calls __scsi_error_from_host_byte (which may
modify the host_byte).

Before this fix:

    cdb to send: 12 01 01 00 00 00
ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
    mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
    status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
    00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10,
    driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
SCSI Status: Check Condition

Sense Information:
sense buffer empty

After:

    cdb to send: 12 01 01 00 00 00
ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
    mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
    status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
    00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0,
    driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
SCSI Status: Check Condition

Sense Information:
 Fixed format, current;  Sense key: Illegal Request
 Additional sense: Invalid field in cdb
 Raw sense data (in hex):
        70 00 05 00 00 00 00 0b  00 00 00 00 24 00 00 00
        00 00 00

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Babu Moger <babu.moger@netapp.com>
Cc: stable@vger.kernel.org [v3.4+]
---
 drivers/scsi/scsi_lib.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index b583277..9377ed2 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -759,7 +759,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 	}
 
 	if (req->cmd_type == REQ_TYPE_BLOCK_PC) { /* SG_IO ioctl from block level */
-		req->errors = result;
 		if (result) {
 			if (sense_valid && req->sense) {
 				/*
@@ -775,6 +774,10 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 			if (!sense_deferred)
 				error = __scsi_error_from_host_byte(cmd, result);
 		}
+		/*
+		 * __scsi_error_from_host_byte may have reset the host_byte
+		 */
+		req->errors = cmd->result;
 
 		req->resid_len = scsi_get_resid(cmd);
 
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RESEND PATCH] SCSI: scsi_lib: fix scsi_io_completion's SG_IO error propagation
  2012-07-25 17:46         ` [RESEND PATCH] SCSI: " Mike Snitzer
@ 2012-07-27 13:29           ` Hannes Reinecke
  0 siblings, 0 replies; 7+ messages in thread
From: Hannes Reinecke @ 2012-07-27 13:29 UTC (permalink / raw)
  To: Mike Snitzer; +Cc: James.Bottomley, Paolo Bonzini, linux-scsi, Babu.Moger

On 07/25/2012 07:46 PM, Mike Snitzer wrote:
> The following v3.4-rc1 commit unmasked an existing bug in
> scsi_io_completion's SG_IO error handling:
> 47ac56d [SCSI] scsi_error: classify some ILLEGAL_REQUEST sense as a permanent TARGET_ERROR
> 
> Given that certain ILLEGAL_REQUEST are now properly categorized as
> TARGET_ERROR the host_byte is being set (before host_byte wasn't ever
> set for these ILLEGAL_REQUEST).
> 
> In scsi_io_completion, initialize req->errors with cmd->result _after_
> the SG_IO block that calls __scsi_error_from_host_byte (which may
> modify the host_byte).
> 
> Before this fix:
> 
>     cdb to send: 12 01 01 00 00 00
> ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
>     mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
>     status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
>     00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0x10,
>     driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
> SCSI Status: Check Condition
> 
> Sense Information:
> sense buffer empty
> 
> After:
> 
>     cdb to send: 12 01 01 00 00 00
> ioctl(3, SG_IO, {'S', SG_DXFER_NONE, cmd[6]=[12, 01, 01, 00, 00, 00],
>     mx_sb_len=32, iovec_count=0, dxfer_len=0, timeout=20000, flags=0,
>     status=02, masked_status=01, sb[19]=[70, 00, 05, 00, 00, 00, 00, 0b,
>     00, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00], host_status=0,
>     driver_status=0x8, resid=0, duration=0, info=0x1}) = 0
> SCSI Status: Check Condition
> 
> Sense Information:
>  Fixed format, current;  Sense key: Illegal Request
>  Additional sense: Invalid field in cdb
>  Raw sense data (in hex):
>         70 00 05 00 00 00 00 0b  00 00 00 00 24 00 00 00
>         00 00 00
> 
> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> Tested-by: Paolo Bonzini <pbonzini@redhat.com>
> Reviewed-by: Babu Moger <babu.moger@netapp.com>
> Cc: stable@vger.kernel.org [v3.4+]

Acked-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes--
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-27 13:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-31 19:05 [PATCH] [SCSI] scsi_lib: fix scsi_io_completion's SG_IO error propagation Mike Snitzer
2012-05-31 19:51 ` Paolo Bonzini
2012-05-31 20:24   ` Mike Snitzer
2012-05-31 20:33     ` Moger, Babu
2012-07-18 23:06       ` Mike Snitzer
2012-07-25 17:46         ` [RESEND PATCH] SCSI: " Mike Snitzer
2012-07-27 13:29           ` Hannes Reinecke

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.