Fix same panic problem as with cd.c when a scsi error happends on

read/write action. It would panic on a diagnosic assertion. When a scsi
read/write command fails, the whole extent is gone bad so mark all as not
done.
This commit is contained in:
reinoud 2006-09-14 17:54:34 +00:00
parent 51d37264ff
commit d1de30eaae
1 changed files with 6 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd.c,v 1.249 2006/07/09 17:12:21 drochner Exp $ */
/* $NetBSD: sd.c,v 1.250 2006/09/14 17:54:34 reinoud Exp $ */
/*-
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.249 2006/07/09 17:12:21 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.250 2006/09/14 17:54:34 reinoud Exp $");
#include "opt_scsi.h"
#include "rnd.h"
@ -935,8 +935,11 @@ sddone(struct scsipi_xfer *xs, int error)
if (bp) {
bp->b_error = error;
bp->b_resid = xs->resid;
if (error)
if (error) {
/* on a read/write error bp->b_resid is zero, so fix */
bp->b_resid =bp->b_bcount;
bp->b_flags |= B_ERROR;
}
disk_unbusy(&sd->sc_dk, bp->b_bcount - bp->b_resid,
(bp->b_flags & B_READ));