public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi_scan.c : add missing interim SDEV_DEL state if slave_alloc fails
@ 2009-01-27 15:39 James Smart
  2009-01-27 16:27 ` James Bottomley
  0 siblings, 1 reply; 2+ messages in thread
From: James Smart @ 2009-01-27 15:39 UTC (permalink / raw)
  To: linux-scsi


We were running i/o and performing a bunch of hba resets in a loop.
This forces a lot of target removes and rescans. Since the resets
are occuring during scan it's causing the scan i/o to timeout or fail,
invoking error recovery, etc.  We end up getting a nasty crash
in scsi_scan.c due to references to old sdevs that had some
lingering references that kept them around.

Fix by setting device state to SDEV_DEL if the LLD's slave_alloc
fails. This will fail reference taking in subsequent teardown/scan paths.

-- james s


 Signed-off-by: James Smart <james.smart@emulex.com>

 ---

 scsi_scan.c |    1 +
 1 file changed, 1 insertion(+)


diff -upNr a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
--- a/drivers/scsi/scsi_scan.c	2009-01-27 09:44:31.000000000 -0500
+++ b/drivers/scsi/scsi_scan.c	2009-01-27 10:12:04.000000000 -0500
@@ -310,6 +310,7 @@ static struct scsi_device *scsi_alloc_sd
 			 */
 			if (ret == -ENXIO)
 				display_failure_msg = 0;
+			scsi_device_set_state(sdev, SDEV_DEL);
 			goto out_device_destroy;
 		}
 	}



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

* Re: [PATCH] scsi_scan.c : add missing interim SDEV_DEL state if slave_alloc fails
  2009-01-27 15:39 [PATCH] scsi_scan.c : add missing interim SDEV_DEL state if slave_alloc fails James Smart
@ 2009-01-27 16:27 ` James Bottomley
  0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2009-01-27 16:27 UTC (permalink / raw)
  To: James.Smart; +Cc: linux-scsi

On Tue, 2009-01-27 at 10:39 -0500, James Smart wrote:
> We were running i/o and performing a bunch of hba resets in a loop.
> This forces a lot of target removes and rescans. Since the resets
> are occuring during scan it's causing the scan i/o to timeout or fail,
> invoking error recovery, etc.  We end up getting a nasty crash
> in scsi_scan.c due to references to old sdevs that had some
> lingering references that kept them around.
> 
> Fix by setting device state to SDEV_DEL if the LLD's slave_alloc
> fails. This will fail reference taking in subsequent teardown/scan paths.
> 
> -- james s
> 
> 
>  Signed-off-by: James Smart <james.smart@emulex.com>
> 
>  ---
> 
>  scsi_scan.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> 
> diff -upNr a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
> --- a/drivers/scsi/scsi_scan.c	2009-01-27 09:44:31.000000000 -0500
> +++ b/drivers/scsi/scsi_scan.c	2009-01-27 10:12:04.000000000 -0500
> @@ -310,6 +310,7 @@ static struct scsi_device *scsi_alloc_sd
>  			 */
>  			if (ret == -ENXIO)
>  				display_failure_msg = 0;
> +			scsi_device_set_state(sdev, SDEV_DEL);

A minor nit (since we only have one user of out_device_destroy) is that
the state setting should be done in the out_device_destroy: branch

James



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

end of thread, other threads:[~2009-01-27 16:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-27 15:39 [PATCH] scsi_scan.c : add missing interim SDEV_DEL state if slave_alloc fails James Smart
2009-01-27 16:27 ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox