Revert part of 1.102:

Don't decrease/check xs_retries when the device report "Power On, Reset, or
Bus Device Reset" sense condition, just retry the command. The initial bus
reset would cause the first TEST_UNIT_READY to report this condition,
and as xs_retries is set to 0 when XS_CTL_DISCOVERY is set, it would report an
error instead of being retried, causing the disk probe to report "drive
offline" instead of the geometry and capacity. Checking/decreasing
xs_retries on the bus reset reported by the adapter is enouth to avoid the
problem reported by rev 1.102.

Problem analysed by Paul Kranenburg, fix confirmed by Anders Hjalmars,
and explaination as to why the INQUIRY wasn't affected by this provided by
Bill Studenmund.
This commit is contained in:
bouyer 2004-04-27 18:15:37 +00:00
parent 032279758d
commit 8cdd8d251c

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipi_base.c,v 1.104 2004/03/16 19:10:43 bouyer Exp $ */
/* $NetBSD: scsipi_base.c,v 1.105 2004/04/27 18:15:37 bouyer Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002, 2003 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.104 2004/03/16 19:10:43 bouyer Exp $");
__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.105 2004/04/27 18:15:37 bouyer Exp $");
#include "opt_scsi.h"
@ -938,12 +938,7 @@ scsipi_interpret_sense(xs)
if (sense->add_sense_code == 0x29 &&
sense->add_sense_code_qual == 0x00) {
/* device or bus reset */
if (xs->xs_retries != 0) {
xs->xs_retries--;
error = ERESTART;
} else
error = EIO;
return (error);
return (ERESTART);
}
if ((periph->periph_flags & PERIPH_REMOVABLE) != 0)
periph->periph_flags &= ~PERIPH_MEDIA_LOADED;