It's not a good idea for device drivers to modify b_flags, as they don't

need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
This commit is contained in:
ad 2007-07-29 12:50:17 +00:00
parent abf11c212d
commit eb171eaaa7
31 changed files with 119 additions and 220 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ld_ataraid.c,v 1.20 2007/03/12 18:18:30 ad Exp $ */ /* $NetBSD: ld_ataraid.c,v 1.21 2007/07/29 12:50:19 ad Exp $ */
/* /*
* Copyright (c) 2003 Wasabi Systems, Inc. * Copyright (c) 2003 Wasabi Systems, Inc.
@ -45,7 +45,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.20 2007/03/12 18:18:30 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.21 2007/07/29 12:50:19 ad Exp $");
#include "rnd.h" #include "rnd.h"
@ -456,7 +456,7 @@ ld_ataraid_iodone_raid0(struct buf *vbp)
/* You are alone */ /* You are alone */
other_cbp->cb_other = NULL; other_cbp->cb_other = NULL;
if (cbp->cb_buf.b_flags & B_ERROR) { if (cbp->cb_buf.b_error != 0) {
/* /*
* Mark this component broken. * Mark this component broken.
*/ */
@ -471,14 +471,14 @@ ld_ataraid_iodone_raid0(struct buf *vbp)
* If we didn't see an error yet and we are reading * If we didn't see an error yet and we are reading
* RAID1 disk, try another component. * RAID1 disk, try another component.
*/ */
if ((bp->b_flags & B_ERROR) == 0 && if (bp->b_error == 0 &&
(cbp->cb_buf.b_flags & B_READ) != 0 && (cbp->cb_buf.b_flags & B_READ) != 0 &&
(aai->aai_level & AAI_L_RAID1) != 0 && (aai->aai_level & AAI_L_RAID1) != 0 &&
cbp->cb_comp < aai->aai_width) { cbp->cb_comp < aai->aai_width) {
cbp->cb_comp += aai->aai_width; cbp->cb_comp += aai->aai_width;
adi = &aai->aai_disks[cbp->cb_comp]; adi = &aai->aai_disks[cbp->cb_comp];
if (adi->adi_status & ADI_S_ONLINE) { if (adi->adi_status & ADI_S_ONLINE) {
cbp->cb_buf.b_flags &= ~B_ERROR; cbp->cb_buf.b_error = 0;
VOP_STRATEGY(cbp->cb_buf.b_vp, &cbp->cb_buf); VOP_STRATEGY(cbp->cb_buf.b_vp, &cbp->cb_buf);
goto out; goto out;
} }
@ -492,7 +492,6 @@ ld_ataraid_iodone_raid0(struct buf *vbp)
*/ */
; ;
else { else {
bp->b_flags |= B_ERROR;
bp->b_error = cbp->cb_buf.b_error ? bp->b_error = cbp->cb_buf.b_error ?
cbp->cb_buf.b_error : EIO; cbp->cb_buf.b_error : EIO;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: wd.c,v 1.341 2007/07/21 19:51:47 ad Exp $ */ /* $NetBSD: wd.c,v 1.342 2007/07/29 12:50:19 ad Exp $ */
/* /*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@ -66,7 +66,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.341 2007/07/21 19:51:47 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.342 2007/07/29 12:50:19 ad Exp $");
#include "opt_ata.h" #include "opt_ata.h"
@ -522,13 +522,13 @@ wdstrategy(struct buf *bp)
(bp->b_bcount % lp->d_secsize) != 0 || (bp->b_bcount % lp->d_secsize) != 0 ||
(bp->b_bcount / lp->d_secsize) >= (1 << NBBY)) { (bp->b_bcount / lp->d_secsize) >= (1 << NBBY)) {
bp->b_error = EINVAL; bp->b_error = EINVAL;
goto bad; goto done;
} }
/* If device invalidated (e.g. media change, door open), error. */ /* If device invalidated (e.g. media change, door open), error. */
if ((wd->sc_flags & WDF_LOADED) == 0) { if ((wd->sc_flags & WDF_LOADED) == 0) {
bp->b_error = EIO; bp->b_error = EIO;
goto bad; goto done;
} }
/* If it's a null transfer, return immediately. */ /* If it's a null transfer, return immediately. */
@ -591,8 +591,6 @@ wdstrategy(struct buf *bp)
wdstart(wd); wdstart(wd);
splx(s); splx(s);
return; return;
bad:
bp->b_flags |= B_ERROR;
done: done:
/* Toss transfer; we're done early. */ /* Toss transfer; we're done early. */
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
@ -632,7 +630,7 @@ wd_split_mod15_write(struct buf *bp)
struct buf *obp = bp->b_private; struct buf *obp = bp->b_private;
struct wd_softc *sc = wd_cd.cd_devs[DISKUNIT(obp->b_dev)]; struct wd_softc *sc = wd_cd.cd_devs[DISKUNIT(obp->b_dev)];
if (__predict_false(bp->b_flags & B_ERROR) != 0) { if (__predict_false(bp->b_error != 0)) {
/* /*
* Propagate the error. If this was the first half of * Propagate the error. If this was the first half of
* the original transfer, make sure to account for that * the original transfer, make sure to account for that
@ -661,7 +659,6 @@ wd_split_mod15_write(struct buf *bp)
return; return;
done: done:
obp->b_flags |= bp->b_flags & B_ERROR;
obp->b_error = bp->b_error; obp->b_error = bp->b_error;
obp->b_resid = bp->b_resid; obp->b_resid = bp->b_resid;
putiobuf(bp); putiobuf(bp);
@ -693,7 +690,6 @@ __wdstart(struct wd_softc *wd, struct buf *bp)
if (__predict_false(nbp == NULL)) { if (__predict_false(nbp == NULL)) {
/* No memory -- fail the iop. */ /* No memory -- fail the iop. */
bp->b_error = ENOMEM; bp->b_error = ENOMEM;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
biodone(bp); biodone(bp);
wd->openings++; wd->openings++;
@ -829,7 +825,6 @@ retry2:
wd->sc_bscount++; wd->sc_bscount++;
} }
#endif #endif
bp->b_flags |= B_ERROR;
bp->b_error = EIO; bp->b_error = EIO;
break; break;
case NOERROR: case NOERROR:
@ -838,7 +833,6 @@ noerror: if ((wd->sc_wdc_bio.flags & ATA_CORR) || wd->retries > 0)
wd->sc_dev.dv_xname); wd->sc_dev.dv_xname);
break; break;
case ERR_NODEV: case ERR_NODEV:
bp->b_flags |= B_ERROR;
bp->b_error = EIO; bp->b_error = EIO;
break; break;
} }
@ -2005,7 +1999,7 @@ wdioctlstrategy(struct buf *bp)
printf("wdioctlstrategy: " printf("wdioctlstrategy: "
"No matching ioctl request found in queue\n"); "No matching ioctl request found in queue\n");
error = EINVAL; error = EINVAL;
goto bad; goto done;
} }
memset(&ata_c, 0, sizeof(ata_c)); memset(&ata_c, 0, sizeof(ata_c));
@ -2017,7 +2011,7 @@ wdioctlstrategy(struct buf *bp)
if (bp->b_bcount != wi->wi_atareq.datalen) { if (bp->b_bcount != wi->wi_atareq.datalen) {
printf("physio split wd ioctl request... cannot proceed\n"); printf("physio split wd ioctl request... cannot proceed\n");
error = EIO; error = EIO;
goto bad; goto done;
} }
/* /*
@ -2029,7 +2023,7 @@ wdioctlstrategy(struct buf *bp)
(bp->b_bcount / wi->wi_softc->sc_dk.dk_label->d_secsize) >= (bp->b_bcount / wi->wi_softc->sc_dk.dk_label->d_secsize) >=
(1 << NBBY)) { (1 << NBBY)) {
error = EINVAL; error = EINVAL;
goto bad; goto done;
} }
/* /*
@ -2038,7 +2032,7 @@ wdioctlstrategy(struct buf *bp)
if (wi->wi_atareq.timeout == 0) { if (wi->wi_atareq.timeout == 0) {
error = EINVAL; error = EINVAL;
goto bad; goto done;
} }
if (wi->wi_atareq.flags & ATACMD_READ) if (wi->wi_atareq.flags & ATACMD_READ)
@ -2066,7 +2060,8 @@ wdioctlstrategy(struct buf *bp)
if (wi->wi_softc->atabus->ata_exec_command(wi->wi_softc->drvp, &ata_c) if (wi->wi_softc->atabus->ata_exec_command(wi->wi_softc->drvp, &ata_c)
!= ATACMD_COMPLETE) { != ATACMD_COMPLETE) {
wi->wi_atareq.retsts = ATACMD_ERROR; wi->wi_atareq.retsts = ATACMD_ERROR;
goto bad; error = EIO;
goto done;
} }
if (ata_c.flags & (AT_ERROR | AT_TIMEOU | AT_DF)) { if (ata_c.flags & (AT_ERROR | AT_TIMEOU | AT_DF)) {
@ -2089,11 +2084,7 @@ wdioctlstrategy(struct buf *bp)
} }
} }
bp->b_error = 0; done:
biodone(bp);
return;
bad:
bp->b_flags |= B_ERROR;
bp->b_error = error; bp->b_error = error;
biodone(bp); biodone(bp);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: ccd.c,v 1.121 2007/07/09 21:00:28 ad Exp $ */ /* $NetBSD: ccd.c,v 1.122 2007/07/29 12:50:17 ad Exp $ */
/*- /*-
* Copyright (c) 1996, 1997, 1998, 1999, 2007 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997, 1998, 1999, 2007 The NetBSD Foundation, Inc.
@ -125,7 +125,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.121 2007/07/09 21:00:28 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.122 2007/07/29 12:50:17 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -671,7 +671,6 @@ ccdstrategy(struct buf *bp)
printf("ccdstrategy: unit %d: not inited\n", unit); printf("ccdstrategy: unit %d: not inited\n", unit);
#endif #endif
bp->b_error = ENXIO; bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
goto done; goto done;
} }
@ -885,7 +884,7 @@ ccdintr(struct ccd_softc *cs, struct buf *bp)
/* /*
* Request is done for better or worse, wakeup the top half. * Request is done for better or worse, wakeup the top half.
*/ */
if (bp->b_flags & B_ERROR) if (bp->b_error != 0)
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
disk_unbusy(&cs->sc_dkdev, (bp->b_bcount - bp->b_resid), disk_unbusy(&cs->sc_dkdev, (bp->b_bcount - bp->b_resid),
(bp->b_flags & B_READ)); (bp->b_flags & B_READ));
@ -920,11 +919,8 @@ ccdiodone(struct buf *vbp)
} }
#endif #endif
if (cbp->cb_buf.b_flags & B_ERROR) { if (cbp->cb_buf.b_error != 0) {
bp->b_flags |= B_ERROR; bp->b_error = cbp->cb_buf.b_error;
bp->b_error = cbp->cb_buf.b_error ?
cbp->cb_buf.b_error : EIO;
printf("%s: error %d on component %d\n", printf("%s: error %d on component %d\n",
cs->sc_xname, bp->b_error, cbp->cb_comp); cs->sc_xname, bp->b_error, cbp->cb_comp);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: cgd.c,v 1.45 2007/06/26 15:22:24 cube Exp $ */ /* $NetBSD: cgd.c,v 1.46 2007/07/29 12:50:18 ad Exp $ */
/*- /*-
* Copyright (c) 2002 The NetBSD Foundation, Inc. * Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.45 2007/06/26 15:22:24 cube Exp $"); __KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.46 2007/07/29 12:50:18 ad Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -364,10 +364,8 @@ cgdiodone(struct buf *nbp)
DPRINTF(CGDB_IO, (" dev 0x%x, nbp %p bn %" PRId64 " addr %p bcnt %d\n", DPRINTF(CGDB_IO, (" dev 0x%x, nbp %p bn %" PRId64 " addr %p bcnt %d\n",
nbp->b_dev, nbp, nbp->b_blkno, nbp->b_data, nbp->b_dev, nbp, nbp->b_blkno, nbp->b_data,
nbp->b_bcount)); nbp->b_bcount));
if (nbp->b_flags & B_ERROR) { if (nbp->b_error != 0) {
obp->b_flags |= B_ERROR; obp->b_error = nbp->b_error;
obp->b_error = nbp->b_error ? nbp->b_error : EIO;
printf("%s: error %d\n", dksc->sc_xname, obp->b_error); printf("%s: error %d\n", dksc->sc_xname, obp->b_error);
} }
@ -389,7 +387,7 @@ cgdiodone(struct buf *nbp)
/* Request is complete for whatever reason */ /* Request is complete for whatever reason */
obp->b_resid = 0; obp->b_resid = 0;
if (obp->b_flags & B_ERROR) if (obp->b_error != 0)
obp->b_resid = obp->b_bcount; obp->b_resid = obp->b_bcount;
disk_unbusy(&dksc->sc_dkdev, obp->b_bcount - obp->b_resid, disk_unbusy(&dksc->sc_dkdev, obp->b_bcount - obp->b_resid,
(obp->b_flags & B_READ)); (obp->b_flags & B_READ));

View File

@ -1,4 +1,4 @@
/* $NetBSD: dksubr.c,v 1.30 2007/07/21 19:51:47 ad Exp $ */ /* $NetBSD: dksubr.c,v 1.31 2007/07/29 12:50:18 ad Exp $ */
/*- /*-
* Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.30 2007/07/21 19:51:47 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.31 2007/07/29 12:50:18 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -192,7 +192,6 @@ dk_strategy(struct dk_intf *di, struct dk_softc *dksc, struct buf *bp)
if (!(dksc->sc_flags & DKF_INITED)) { if (!(dksc->sc_flags & DKF_INITED)) {
DPRINTF_FOLLOW(("dk_strategy: not inited\n")); DPRINTF_FOLLOW(("dk_strategy: not inited\n"));
bp->b_error = ENXIO; bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
biodone(bp); biodone(bp);
return; return;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: dk.c,v 1.27 2007/07/21 19:51:47 ad Exp $ */ /* $NetBSD: dk.c,v 1.28 2007/07/29 12:50:20 ad Exp $ */
/*- /*-
* Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.27 2007/07/21 19:51:47 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.28 2007/07/29 12:50:20 ad Exp $");
#include "opt_dkwedge.h" #include "opt_dkwedge.h"
@ -999,7 +999,6 @@ dkstrategy(struct buf *bp)
if (sc->sc_state != DKW_STATE_RUNNING) { if (sc->sc_state != DKW_STATE_RUNNING) {
bp->b_error = ENXIO; bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
goto done; goto done;
} }
@ -1048,7 +1047,6 @@ dkstart(struct dkwedge_softc *sc)
wakeup(&sc->sc_iopend); wakeup(&sc->sc_iopend);
} }
bp->b_error = ENXIO; bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
biodone(bp); biodone(bp);
} }
@ -1100,10 +1098,8 @@ dkiodone(struct buf *bp)
struct buf *obp = bp->b_private; struct buf *obp = bp->b_private;
struct dkwedge_softc *sc = dkwedge_lookup(obp->b_dev); struct dkwedge_softc *sc = dkwedge_lookup(obp->b_dev);
if (bp->b_flags & B_ERROR) { if (bp->b_error != 0)
obp->b_flags |= B_ERROR;
obp->b_error = bp->b_error; obp->b_error = bp->b_error;
}
obp->b_resid = bp->b_resid; obp->b_resid = bp->b_resid;
putiobuf(bp); putiobuf(bp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fss.c,v 1.33 2007/07/09 21:00:28 ad Exp $ */ /* $NetBSD: fss.c,v 1.34 2007/07/29 12:50:18 ad Exp $ */
/*- /*-
* Copyright (c) 2003 The NetBSD Foundation, Inc. * Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.33 2007/07/09 21:00:28 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.34 2007/07/29 12:50:18 ad Exp $");
#include "fss.h" #include "fss.h"
@ -236,7 +236,6 @@ fss_strategy(struct buf *bp)
FSS_UNLOCK(sc, s); FSS_UNLOCK(sc, s);
bp->b_error = (sc == NULL ? ENODEV : EROFS); bp->b_error = (sc == NULL ? ENODEV : EROFS);
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
biodone(bp); biodone(bp);
return; return;
@ -823,7 +822,7 @@ fss_cluster_iodone(struct buf *bp)
FSS_LOCK(scp->fc_softc, s); FSS_LOCK(scp->fc_softc, s);
if (bp->b_flags & B_ERROR) if (bp->b_error != 0)
fss_error(scp->fc_softc, "fs read error %d", bp->b_error); fss_error(scp->fc_softc, "fs read error %d", bp->b_error);
if (--scp->fc_xfercount == 0) if (--scp->fc_xfercount == 0)
@ -1084,7 +1083,6 @@ fss_bs_thread(void *arg)
if (error) { if (error) {
bp->b_error = error; bp->b_error = error;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
} else } else
bp->b_resid = 0; bp->b_resid = 0;
@ -1139,7 +1137,6 @@ fss_bs_thread(void *arg)
if (!FSS_ISVALID(sc)) { if (!FSS_ISVALID(sc)) {
bp->b_error = ENXIO; bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
biodone(bp); biodone(bp);
continue; continue;
@ -1169,7 +1166,6 @@ fss_bs_thread(void *arg)
if (biowait(nbp) != 0) { if (biowait(nbp) != 0) {
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
bp->b_error = nbp->b_error; bp->b_error = nbp->b_error;
bp->b_flags |= B_ERROR;
biodone(bp); biodone(bp);
FSS_LOCK(sc, s); FSS_LOCK(sc, s);
continue; continue;
@ -1227,7 +1223,6 @@ fss_bs_thread(void *arg)
off, len, addr)) != 0) { off, len, addr)) != 0) {
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
bp->b_error = error; bp->b_error = error;
bp->b_flags |= B_ERROR;
FSS_LOCK(sc, s); FSS_LOCK(sc, s);
break; break;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: ld_iop.c,v 1.24 2007/06/16 12:32:13 ad Exp $ */ /* $NetBSD: ld_iop.c,v 1.25 2007/07/29 12:50:20 ad Exp $ */
/*- /*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ld_iop.c,v 1.24 2007/06/16 12:32:13 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: ld_iop.c,v 1.25 2007/07/29 12:50:20 ad Exp $");
#include "rnd.h" #include "rnd.h"
@ -505,7 +505,6 @@ ld_iop_intr(struct device *dv, struct iop_msg *im, void *reply)
} }
if (err) { if (err) {
bp->b_flags |= B_ERROR;
bp->b_error = EIO; bp->b_error = EIO;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
} else } else

View File

@ -1,4 +1,4 @@
/* $NetBSD: ld_aac.c,v 1.15 2007/06/05 04:04:14 briggs Exp $ */ /* $NetBSD: ld_aac.c,v 1.16 2007/07/29 12:50:20 ad Exp $ */
/*- /*-
* Copyright (c) 2002 The NetBSD Foundation, Inc. * Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ld_aac.c,v 1.15 2007/06/05 04:04:14 briggs Exp $"); __KERNEL_RCSID(0, "$NetBSD: ld_aac.c,v 1.16 2007/07/29 12:50:20 ad Exp $");
#include "rnd.h" #include "rnd.h"
@ -330,7 +330,6 @@ ld_aac_intr(struct aac_ccb *ac)
aac_ccb_free(aac, ac); aac_ccb_free(aac, ac);
if (status != ST_OK) { if (status != ST_OK) {
bp->b_flags |= B_ERROR;
bp->b_error = EIO; bp->b_error = EIO;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ld_cac.c,v 1.17 2007/02/09 21:55:27 ad Exp $ */ /* $NetBSD: ld_cac.c,v 1.18 2007/07/29 12:50:20 ad Exp $ */
/*- /*-
* Copyright (c) 2000, 2006 The NetBSD Foundation, Inc. * Copyright (c) 2000, 2006 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ld_cac.c,v 1.17 2007/02/09 21:55:27 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: ld_cac.c,v 1.18 2007/07/29 12:50:20 ad Exp $");
#include "rnd.h" #include "rnd.h"
@ -220,7 +220,6 @@ ld_cac_done(struct device *dv, void *context, int error)
} }
if (rv) { if (rv) {
bp->b_flags |= B_ERROR;
bp->b_error = rv; bp->b_error = rv;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
} else } else

View File

@ -1,4 +1,4 @@
/* $NetBSD: ld_icp.c,v 1.16 2006/11/16 01:32:51 christos Exp $ */ /* $NetBSD: ld_icp.c,v 1.17 2007/07/29 12:50:20 ad Exp $ */
/*- /*-
* Copyright (c) 2002 The NetBSD Foundation, Inc. * Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ld_icp.c,v 1.16 2006/11/16 01:32:51 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: ld_icp.c,v 1.17 2007/07/29 12:50:20 ad Exp $");
#include "rnd.h" #include "rnd.h"
@ -316,7 +316,6 @@ ld_icp_intr(struct icp_ccb *ic)
if (ic->ic_status != ICP_S_OK) { if (ic->ic_status != ICP_S_OK) {
printf("%s: request failed; status=0x%04x\n", printf("%s: request failed; status=0x%04x\n",
ic->ic_dv->dv_xname, ic->ic_status); ic->ic_dv->dv_xname, ic->ic_status);
bp->b_flags |= B_ERROR;
bp->b_error = EIO; bp->b_error = EIO;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ld_mlx.c,v 1.13 2006/11/16 01:32:51 christos Exp $ */ /* $NetBSD: ld_mlx.c,v 1.14 2007/07/29 12:50:20 ad Exp $ */
/*- /*-
* Copyright (c) 2001 The NetBSD Foundation, Inc. * Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ld_mlx.c,v 1.13 2006/11/16 01:32:51 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: ld_mlx.c,v 1.14 2007/07/29 12:50:20 ad Exp $");
#include "rnd.h" #include "rnd.h"
@ -237,7 +237,6 @@ ld_mlx_handler(struct mlx_ccb *mc)
mlx = (struct mlx_softc *)device_parent(&sc->sc_ld.sc_dv); mlx = (struct mlx_softc *)device_parent(&sc->sc_ld.sc_dv);
if (mc->mc_status != MLX_STATUS_OK) { if (mc->mc_status != MLX_STATUS_OK) {
bp->b_flags |= B_ERROR;
bp->b_error = EIO; bp->b_error = EIO;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rrunner.c,v 1.62 2007/07/09 21:00:38 ad Exp $ */ /* $NetBSD: rrunner.c,v 1.63 2007/07/29 12:50:20 ad Exp $ */
/* /*
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.62 2007/07/09 21:00:38 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.63 2007/07/29 12:50:20 ad Exp $");
#include "opt_inet.h" #include "opt_inet.h"
@ -1326,7 +1326,6 @@ esh_fpstrategy(bp)
s = splnet(); s = splnet();
if (sc == NULL || ulp == HIPPI_ULP_802) { if (sc == NULL || ulp == HIPPI_ULP_802) {
bp->b_error = ENXIO; bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
goto done; goto done;
} }
@ -1337,7 +1336,6 @@ esh_fpstrategy(bp)
if ((sc->sc_flags & UP_FLAGS) != UP_FLAGS) { if ((sc->sc_flags & UP_FLAGS) != UP_FLAGS) {
bp->b_error = EBUSY; bp->b_error = EBUSY;
bp->b_flags |= B_ERROR;
goto done; goto done;
} }
#undef UP_FLAGS #undef UP_FLAGS
@ -1353,7 +1351,6 @@ esh_fpstrategy(bp)
if (di == NULL) { if (di == NULL) {
bp->b_error = ENOMEM; bp->b_error = ENOMEM;
bp->b_flags |= B_ERROR;
goto done; goto done;
} }
di->ed_buf = bp; di->ed_buf = bp;
@ -1367,7 +1364,6 @@ esh_fpstrategy(bp)
"failed\terror code %d\n", "failed\terror code %d\n",
sc->sc_dev.dv_xname, error); sc->sc_dev.dv_xname, error);
bp->b_error = ENOBUFS; bp->b_error = ENOBUFS;
bp->b_flags |= B_ERROR;
esh_free_dmainfo(sc, di); esh_free_dmainfo(sc, di);
goto done; goto done;
} }
@ -2715,7 +2711,6 @@ esh_read_fp_ring(sc, consumer, error, ulp)
di->ed_buf->b_resid = di->ed_buf->b_resid =
di->ed_buf->b_bcount; di->ed_buf->b_bcount;
di->ed_buf->b_error = EIO; di->ed_buf->b_error = EIO;
di->ed_buf->b_flags |= B_ERROR;
} else { } else {
di->ed_error = EIO; di->ed_error = EIO;
recv->ec_error = 0; recv->ec_error = 0;
@ -3380,7 +3375,6 @@ eshstop(sc)
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
bp->b_error = EIO; bp->b_error = EIO;
bp->b_flags |= B_ERROR;
biodone(bp); biodone(bp);
} else if (sc->sc_send.ec_cur_dmainfo) { } else if (sc->sc_send.ec_cur_dmainfo) {
struct esh_dmainfo *di = sc->sc_send.ec_cur_dmainfo; struct esh_dmainfo *di = sc->sc_send.ec_cur_dmainfo;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.74 2007/07/09 21:00:49 ad Exp $ */ /* $NetBSD: fd.c,v 1.75 2007/07/29 12:50:21 ad Exp $ */
/*- /*-
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@ -88,7 +88,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.74 2007/07/09 21:00:49 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.75 2007/07/29 12:50:21 ad Exp $");
#include "rnd.h" #include "rnd.h"
#include "opt_ddb.h" #include "opt_ddb.h"
@ -590,7 +590,7 @@ fdstrategy(bp)
((bp->b_bcount % FDC_BSIZE) != 0 && ((bp->b_bcount % FDC_BSIZE) != 0 &&
(bp->b_flags & B_FORMAT) == 0)) { (bp->b_flags & B_FORMAT) == 0)) {
bp->b_error = EINVAL; bp->b_error = EINVAL;
goto bad; goto done;
} }
/* If it's a null transfer, return immediately. */ /* If it's a null transfer, return immediately. */
@ -608,7 +608,7 @@ fdstrategy(bp)
if (sz < 0) { if (sz < 0) {
/* If past end of disk, return EINVAL. */ /* If past end of disk, return EINVAL. */
bp->b_error = EINVAL; bp->b_error = EINVAL;
goto bad; goto done;
} }
/* Otherwise, truncate request. */ /* Otherwise, truncate request. */
bp->b_bcount = sz << DEV_BSHIFT; bp->b_bcount = sz << DEV_BSHIFT;
@ -642,8 +642,6 @@ fdstrategy(bp)
splx(s); splx(s);
return; return;
bad:
bp->b_flags |= B_ERROR;
done: done:
/* Toss transfer; we're done early. */ /* Toss transfer; we're done early. */
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
@ -1294,7 +1292,6 @@ fdcretry(fdc)
fdc->sc_status[5]); fdc->sc_status[5]);
} }
bp->b_flags |= B_ERROR;
bp->b_error = EIO; bp->b_error = EIO;
fdfinish(fd, bp); fdfinish(fd, bp);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcd.c,v 1.99 2007/07/09 21:00:49 ad Exp $ */ /* $NetBSD: mcd.c,v 1.100 2007/07/29 12:50:21 ad Exp $ */
/* /*
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
@ -56,7 +56,7 @@
/*static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";*/ /*static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";*/
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.99 2007/07/09 21:00:49 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.100 2007/07/29 12:50:21 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -440,14 +440,14 @@ mcdstrategy(bp)
printf("%s: strategy: blkno = %" PRId64 " bcount = %d\n", printf("%s: strategy: blkno = %" PRId64 " bcount = %d\n",
sc->sc_dev.dv_xname, bp->b_blkno, bp->b_bcount); sc->sc_dev.dv_xname, bp->b_blkno, bp->b_bcount);
bp->b_error = EINVAL; bp->b_error = EINVAL;
goto bad; goto done;
} }
/* If device invalidated (e.g. media change, door open), error. */ /* If device invalidated (e.g. media change, door open), error. */
if ((sc->flags & MCDF_LOADED) == 0) { if ((sc->flags & MCDF_LOADED) == 0) {
MCD_TRACE("strategy: drive not valid%s", "\n"); MCD_TRACE("strategy: drive not valid%s", "\n");
bp->b_error = EIO; bp->b_error = EIO;
goto bad; goto done;
} }
/* No data to read. */ /* No data to read. */
@ -481,8 +481,6 @@ mcdstrategy(bp)
mcdstart(sc); mcdstart(sc);
return; return;
bad:
bp->b_flags |= B_ERROR;
done: done:
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
biodone(bp); biodone(bp);
@ -513,7 +511,6 @@ loop:
if ((sc->flags & MCDF_LOADED) == 0) { if ((sc->flags & MCDF_LOADED) == 0) {
MCD_TRACE("start: drive not valid%s", "\n"); MCD_TRACE("start: drive not valid%s", "\n");
bp->b_error = EIO; bp->b_error = EIO;
bp->b_flags |= B_ERROR;
biodone(bp); biodone(bp);
goto loop; goto loop;
} }
@ -1324,7 +1321,7 @@ readerr:
changed: changed:
/* Invalidate the buffer. */ /* Invalidate the buffer. */
bp->b_flags |= B_ERROR; bp->b_error = EIO;
bp->b_resid = bp->b_bcount - mbx->skip; bp->b_resid = bp->b_bcount - mbx->skip;
disk_unbusy(&sc->sc_dk, (bp->b_bcount - bp->b_resid), disk_unbusy(&sc->sc_dk, (bp->b_bcount - bp->b_resid),
(bp->b_flags & B_READ)); (bp->b_flags & B_READ));

View File

@ -1,4 +1,4 @@
/* $NetBSD: wt.c,v 1.76 2007/07/09 21:00:50 ad Exp $ */ /* $NetBSD: wt.c,v 1.77 2007/07/29 12:50:21 ad Exp $ */
/* /*
* Streamer tape driver. * Streamer tape driver.
@ -51,7 +51,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wt.c,v 1.76 2007/07/09 21:00:50 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: wt.c,v 1.77 2007/07/29 12:50:21 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -648,7 +648,6 @@ wtstrategy(struct buf *bp)
if (sc->flags & TPEXCEP) { if (sc->flags & TPEXCEP) {
errxit: errxit:
bp->b_flags |= B_ERROR;
bp->b_error = EIO; bp->b_error = EIO;
} }
xit: xit:

View File

@ -1,4 +1,4 @@
/* $NetBSD: ld.c,v 1.48 2007/07/21 19:51:47 ad Exp $ */ /* $NetBSD: ld.c,v 1.49 2007/07/29 12:50:18 ad Exp $ */
/*- /*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.48 2007/07/21 19:51:47 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.49 2007/07/29 12:50:18 ad Exp $");
#include "rnd.h" #include "rnd.h"
@ -551,7 +551,7 @@ ldstrategy(struct buf *bp)
if ((sc->sc_flags & LDF_DETACH) != 0) { if ((sc->sc_flags & LDF_DETACH) != 0) {
bp->b_error = EIO; bp->b_error = EIO;
goto bad; goto done;
} }
lp = sc->sc_dk.dk_label; lp = sc->sc_dk.dk_label;
@ -562,7 +562,7 @@ ldstrategy(struct buf *bp)
*/ */
if ((bp->b_bcount % lp->d_secsize) != 0 || bp->b_blkno < 0) { if ((bp->b_bcount % lp->d_secsize) != 0 || bp->b_blkno < 0) {
bp->b_error = EINVAL; bp->b_error = EINVAL;
goto bad; goto done;
} }
/* If it's a null transfer, return immediately. */ /* If it's a null transfer, return immediately. */
@ -600,8 +600,6 @@ ldstrategy(struct buf *bp)
splx(s); splx(s);
return; return;
bad:
bp->b_flags |= B_ERROR;
done: done:
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
biodone(bp); biodone(bp);
@ -647,7 +645,6 @@ ldstart(struct ld_softc *sc, struct buf *bp)
} else { } else {
(void) BUFQ_GET(sc->sc_bufq); (void) BUFQ_GET(sc->sc_bufq);
bp->b_error = error; bp->b_error = error;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
mutex_exit(&sc->sc_mutex); mutex_exit(&sc->sc_mutex);
biodone(bp); biodone(bp);
@ -663,7 +660,7 @@ void
lddone(struct ld_softc *sc, struct buf *bp) lddone(struct ld_softc *sc, struct buf *bp)
{ {
if ((bp->b_flags & B_ERROR) != 0) { if (bp->b_error != 0) {
diskerr(bp, "ld", "error", LOG_PRINTF, 0, sc->sc_dk.dk_label); diskerr(bp, "ld", "error", LOG_PRINTF, 0, sc->sc_dk.dk_label);
printf("\n"); printf("\n");
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: ed_mca.c,v 1.36 2007/07/21 19:51:48 ad Exp $ */ /* $NetBSD: ed_mca.c,v 1.37 2007/07/29 12:50:21 ad Exp $ */
/* /*
* Copyright (c) 2001 The NetBSD Foundation, Inc. * Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.36 2007/07/21 19:51:48 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.37 2007/07/29 12:50:21 ad Exp $");
#include "rnd.h" #include "rnd.h"
@ -217,13 +217,13 @@ edmcastrategy(bp)
(bp->b_bcount % lp->d_secsize) != 0 || (bp->b_bcount % lp->d_secsize) != 0 ||
(bp->b_bcount / lp->d_secsize) >= (1 << NBBY)) { (bp->b_bcount / lp->d_secsize) >= (1 << NBBY)) {
bp->b_error = EINVAL; bp->b_error = EINVAL;
goto bad; goto done;
} }
/* If device invalidated (e.g. media change, door open), error. */ /* If device invalidated (e.g. media change, door open), error. */
if ((ed->sc_flags & WDF_LOADED) == 0) { if ((ed->sc_flags & WDF_LOADED) == 0) {
bp->b_error = EIO; bp->b_error = EIO;
goto bad; goto done;
} }
/* If it's a null transfer, return immediately. */ /* If it's a null transfer, return immediately. */
@ -262,8 +262,6 @@ edmcastrategy(bp)
wakeup_one(ed->edc_softc); wakeup_one(ed->edc_softc);
return; return;
bad:
bp->b_flags |= B_ERROR;
done: done:
/* Toss transfer; we're done early. */ /* Toss transfer; we're done early. */
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;

View File

@ -1,4 +1,4 @@
/* $NetBSD: edc_mca.c,v 1.36 2007/07/09 21:00:51 ad Exp $ */ /* $NetBSD: edc_mca.c,v 1.37 2007/07/29 12:50:21 ad Exp $ */
/* /*
* Copyright (c) 2001 The NetBSD Foundation, Inc. * Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -50,7 +50,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.36 2007/07/09 21:00:51 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.37 2007/07/29 12:50:21 ad Exp $");
#include "rnd.h" #include "rnd.h"
@ -845,7 +845,6 @@ edcworker(void *arg)
if (error) { if (error) {
bp->b_error = error; bp->b_error = error;
bp->b_flags |= B_ERROR;
} else { } else {
/* Set resid, most commonly to zero. */ /* Set resid, most commonly to zero. */
bp->b_resid = sc->sc_resblk * DEV_BSIZE; bp->b_resid = sc->sc_resblk * DEV_BSIZE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.49 2007/07/15 08:40:22 dsl Exp $ */ /* $NetBSD: md.c,v 1.50 2007/07/29 12:50:18 ad Exp $ */
/* /*
* Copyright (c) 1995 Gordon W. Ross, Leo Weppelman. * Copyright (c) 1995 Gordon W. Ross, Leo Weppelman.
@ -46,7 +46,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.49 2007/07/15 08:40:22 dsl Exp $"); __KERNEL_RCSID(0, "$NetBSD: md.c,v 1.50 2007/07/29 12:50:18 ad Exp $");
#include "opt_md.h" #include "opt_md.h"
@ -319,7 +319,6 @@ mdstrategy(struct buf *bp)
if (sc->sc_type == MD_UNCONFIGURED) { if (sc->sc_type == MD_UNCONFIGURED) {
bp->b_error = ENXIO; bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
goto done; goto done;
} }
@ -359,7 +358,6 @@ mdstrategy(struct buf *bp)
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
set_eio: set_eio:
bp->b_error = EIO; bp->b_error = EIO;
bp->b_flags |= B_ERROR;
break; break;
} }
done: done:
@ -508,7 +506,6 @@ md_server_loop(struct md_softc *sc)
done: done:
if (error) { if (error) {
bp->b_error = error; bp->b_error = error;
bp->b_flags |= B_ERROR;
} }
biodone(bp); biodone(bp);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: ld_amr.c,v 1.12 2006/11/16 01:33:09 christos Exp $ */ /* $NetBSD: ld_amr.c,v 1.13 2007/07/29 12:50:22 ad Exp $ */
/*- /*-
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ld_amr.c,v 1.12 2006/11/16 01:33:09 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: ld_amr.c,v 1.13 2007/07/29 12:50:22 ad Exp $");
#include "rnd.h" #include "rnd.h"
@ -203,7 +203,6 @@ ld_amr_handler(struct amr_ccb *ac)
printf("%s: cmd status 0x%02x\n", sc->sc_ld.sc_dv.dv_xname, printf("%s: cmd status 0x%02x\n", sc->sc_ld.sc_dv.dv_xname,
ac->ac_status); ac->ac_status);
bp->b_flags |= B_ERROR;
bp->b_error = EIO; bp->b_error = EIO;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
} else } else

View File

@ -1,5 +1,5 @@
/* $wasabi: ld_twa.c,v 1.9 2006/02/14 18:44:37 jordanr Exp $ */ /* $wasabi: ld_twa.c,v 1.9 2006/02/14 18:44:37 jordanr Exp $ */
/* $NetBSD: ld_twa.c,v 1.6 2007/07/21 19:06:21 ad Exp $ */ /* $NetBSD: ld_twa.c,v 1.7 2007/07/29 12:50:22 ad Exp $ */
/*- /*-
* Copyright (c) 2000, 2001, 2002, 2003, 2004 The NetBSD Foundation, Inc. * Copyright (c) 2000, 2001, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ld_twa.c,v 1.6 2007/07/21 19:06:21 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: ld_twa.c,v 1.7 2007/07/29 12:50:22 ad Exp $");
#include "rnd.h" #include "rnd.h"
@ -224,7 +224,6 @@ ld_twa_handler(struct twa_request *tr)
status = tr->tr_command->command.cmd_pkt_9k.status; status = tr->tr_command->command.cmd_pkt_9k.status;
if (status != 0) { if (status != 0) {
bp->b_flags |= B_ERROR;
bp->b_error = EIO; bp->b_error = EIO;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
} else { } else {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ld_twe.c,v 1.27 2007/07/21 19:06:21 ad Exp $ */ /* $NetBSD: ld_twe.c,v 1.28 2007/07/29 12:50:22 ad Exp $ */
/*- /*-
* Copyright (c) 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. * Copyright (c) 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ld_twe.c,v 1.27 2007/07/21 19:06:21 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: ld_twe.c,v 1.28 2007/07/29 12:50:22 ad Exp $");
#include "rnd.h" #include "rnd.h"
@ -264,7 +264,6 @@ ld_twe_handler(struct twe_ccb *ccb, int error)
twe_ccb_free(twe, ccb); twe_ccb_free(twe, ccb);
if (error) { if (error) {
bp->b_flags |= B_ERROR;
bp->b_error = error; bp->b_error = error;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
} else } else

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_netbsdkintf.c,v 1.229 2007/07/18 19:04:58 ad Exp $ */ /* $NetBSD: rf_netbsdkintf.c,v 1.230 2007/07/29 12:50:22 ad Exp $ */
/*- /*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
@ -146,7 +146,7 @@
***********************************************************/ ***********************************************************/
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.229 2007/07/18 19:04:58 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.230 2007/07/29 12:50:22 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/errno.h> #include <sys/errno.h>
@ -747,18 +747,15 @@ raidstrategy(struct buf *bp)
if ((rs->sc_flags & RAIDF_INITED) ==0) { if ((rs->sc_flags & RAIDF_INITED) ==0) {
bp->b_error = ENXIO; bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
goto done; goto done;
} }
if (raidID >= numraid || !raidPtrs[raidID]) { if (raidID >= numraid || !raidPtrs[raidID]) {
bp->b_error = ENODEV; bp->b_error = ENODEV;
bp->b_flags |= B_ERROR;
goto done; goto done;
} }
raidPtr = raidPtrs[raidID]; raidPtr = raidPtrs[raidID];
if (!raidPtr->valid) { if (!raidPtr->valid) {
bp->b_error = ENODEV; bp->b_error = ENODEV;
bp->b_flags |= B_ERROR;
goto done; goto done;
} }
if (bp->b_bcount == 0) { if (bp->b_bcount == 0) {
@ -1861,7 +1858,6 @@ raidstart(RF_Raid_t *raidPtr)
if ((sum > raidPtr->totalSectors) || (sum < raid_addr) if ((sum > raidPtr->totalSectors) || (sum < raid_addr)
|| (sum < num_blocks) || (sum < pb)) { || (sum < num_blocks) || (sum < pb)) {
bp->b_error = ENOSPC; bp->b_error = ENOSPC;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
biodone(bp); biodone(bp);
RF_LOCK_MUTEX(raidPtr->mutex); RF_LOCK_MUTEX(raidPtr->mutex);
@ -1873,7 +1869,6 @@ raidstart(RF_Raid_t *raidPtr)
if (bp->b_bcount & raidPtr->sectorMask) { if (bp->b_bcount & raidPtr->sectorMask) {
bp->b_error = EINVAL; bp->b_error = EINVAL;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
biodone(bp); biodone(bp);
RF_LOCK_MUTEX(raidPtr->mutex); RF_LOCK_MUTEX(raidPtr->mutex);
@ -1907,7 +1902,6 @@ raidstart(RF_Raid_t *raidPtr)
if (rc) { if (rc) {
bp->b_error = rc; bp->b_error = rc;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
biodone(bp); biodone(bp);
/* continue loop */ /* continue loop */
@ -2025,10 +2019,10 @@ KernelWakeupFunc(struct buf *bp)
} }
#endif #endif
/* XXX Ok, let's get aggressive... If B_ERROR is set, let's go /* XXX Ok, let's get aggressive... If b_error is set, let's go
* ballistic, and mark the component as hosed... */ * ballistic, and mark the component as hosed... */
if (bp->b_flags & B_ERROR) { if (bp->b_error != 0) {
/* Mark the disk as dead */ /* Mark the disk as dead */
/* but only mark it once... */ /* but only mark it once... */
/* and only if it wouldn't leave this RAID set /* and only if it wouldn't leave this RAID set
@ -2055,7 +2049,7 @@ KernelWakeupFunc(struct buf *bp)
/* Fill in the error value */ /* Fill in the error value */
req->error = (bp->b_flags & B_ERROR) ? bp->b_error : 0; req->error = bp->b_error;
simple_lock(&queue->raidPtr->iodone_lock); simple_lock(&queue->raidPtr->iodone_lock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_states.c,v 1.40 2005/12/11 12:23:37 christos Exp $ */ /* $NetBSD: rf_states.c,v 1.41 2007/07/29 12:50:22 ad Exp $ */
/* /*
* Copyright (c) 1995 Carnegie-Mellon University. * Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved. * All rights reserved.
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_states.c,v 1.40 2005/12/11 12:23:37 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: rf_states.c,v 1.41 2007/07/29 12:50:22 ad Exp $");
#include <sys/errno.h> #include <sys/errno.h>
@ -528,7 +528,6 @@ rf_State_CreateDAG(RF_RaidAccessDesc_t *desc)
/* skip straight to rf_State_Cleanup() */ /* skip straight to rf_State_Cleanup() */
desc->state = rf_CleanupState; desc->state = rf_CleanupState;
bp = (struct buf *)desc->bp; bp = (struct buf *)desc->bp;
bp->b_flags |= B_ERROR;
bp->b_error = EIO; bp->b_error = EIO;
} else { } else {
/* bind dags to desc */ /* bind dags to desc */

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd.c,v 1.266 2007/07/21 19:51:48 ad Exp $ */ /* $NetBSD: cd.c,v 1.267 2007/07/29 12:50:22 ad Exp $ */
/*- /*-
* Copyright (c) 1998, 2001, 2003, 2004, 2005 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2001, 2003, 2004, 2005 The NetBSD Foundation, Inc.
@ -57,7 +57,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.266 2007/07/21 19:51:48 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.267 2007/07/29 12:50:22 ad Exp $");
#include "rnd.h" #include "rnd.h"
@ -580,7 +580,7 @@ cdstrategy(struct buf *bp)
bp->b_error = EIO; bp->b_error = EIO;
else else
bp->b_error = ENODEV; bp->b_error = ENODEV;
goto bad; goto done;
} }
lp = cd->sc_dk.dk_label; lp = cd->sc_dk.dk_label;
@ -592,7 +592,7 @@ cdstrategy(struct buf *bp)
if ((bp->b_bcount % lp->d_secsize) != 0 || if ((bp->b_bcount % lp->d_secsize) != 0 ||
bp->b_blkno < 0 ) { bp->b_blkno < 0 ) {
bp->b_error = EINVAL; bp->b_error = EINVAL;
goto bad; goto done;
} }
/* /*
* If it's a null transfer, return immediately * If it's a null transfer, return immediately
@ -644,7 +644,7 @@ cdstrategy(struct buf *bp)
/* XXXX We don't support bouncing writes. */ /* XXXX We don't support bouncing writes. */
bp->b_error = EACCES; bp->b_error = EACCES;
goto bad; goto done;
} }
count = ((blkno * lp->d_secsize) % cd->params.blksize); count = ((blkno * lp->d_secsize) % cd->params.blksize);
/* XXX Store starting offset in bp->b_rawblkno */ /* XXX Store starting offset in bp->b_rawblkno */
@ -658,14 +658,14 @@ cdstrategy(struct buf *bp)
if (!nbp) { if (!nbp) {
/* No memory -- fail the iop. */ /* No memory -- fail the iop. */
bp->b_error = ENOMEM; bp->b_error = ENOMEM;
goto bad; goto done;
} }
bounce = malloc(count, M_DEVBUF, M_NOWAIT); bounce = malloc(count, M_DEVBUF, M_NOWAIT);
if (!bounce) { if (!bounce) {
/* No memory -- fail the iop. */ /* No memory -- fail the iop. */
putiobuf(nbp); putiobuf(nbp);
bp->b_error = ENOMEM; bp->b_error = ENOMEM;
goto bad; goto done;
} }
/* Set up the IOP to the bounce buffer. */ /* Set up the IOP to the bounce buffer. */
@ -715,8 +715,6 @@ cdstrategy(struct buf *bp)
splx(s); splx(s);
return; return;
bad:
bp->b_flags |= B_ERROR;
done: done:
/* /*
* Correctly set the buf to indicate a completed xfer * Correctly set the buf to indicate a completed xfer
@ -777,7 +775,6 @@ cdstart(struct scsipi_periph *periph)
(periph->periph_flags & PERIPH_MEDIA_LOADED) == 0)) { (periph->periph_flags & PERIPH_MEDIA_LOADED) == 0)) {
if ((bp = BUFQ_GET(cd->buf_queue)) != NULL) { if ((bp = BUFQ_GET(cd->buf_queue)) != NULL) {
bp->b_error = EIO; bp->b_error = EIO;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
biodone(bp); biodone(bp);
continue; continue;
@ -894,7 +891,6 @@ cddone(struct scsipi_xfer *xs, int error)
if (error) { if (error) {
/* on a read/write error bp->b_resid is zero, so fix */ /* on a read/write error bp->b_resid is zero, so fix */
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
bp->b_flags |= B_ERROR;
} }
disk_unbusy(&cd->sc_dk, bp->b_bcount - bp->b_resid, disk_unbusy(&cd->sc_dk, bp->b_bcount - bp->b_resid,
@ -912,7 +908,7 @@ cdbounce(struct buf *bp)
{ {
struct buf *obp = (struct buf *)bp->b_private; struct buf *obp = (struct buf *)bp->b_private;
if (bp->b_flags & B_ERROR) { if (bp->b_error != 0) {
/* EEK propagate the error and free the memory */ /* EEK propagate the error and free the memory */
goto done; goto done;
} }
@ -938,7 +934,6 @@ cdbounce(struct buf *bp)
nbp = getiobuf_nowait(); nbp = getiobuf_nowait();
if (!nbp) { if (!nbp) {
/* No buf available. */ /* No buf available. */
bp->b_flags |= B_ERROR;
bp->b_error = ENOMEM; bp->b_error = ENOMEM;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
goto done; goto done;
@ -985,7 +980,6 @@ cdbounce(struct buf *bp)
} }
} }
done: done:
obp->b_flags |= bp->b_flags & B_ERROR;
obp->b_error = bp->b_error; obp->b_error = bp->b_error;
obp->b_resid = bp->b_resid; obp->b_resid = bp->b_resid;
free(bp->b_data, M_DEVBUF); free(bp->b_data, M_DEVBUF);

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsipi_ioctl.c,v 1.62 2007/03/04 06:02:43 christos Exp $ */ /* $NetBSD: scsipi_ioctl.c,v 1.63 2007/07/29 12:50:23 ad Exp $ */
/*- /*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@ -44,7 +44,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.62 2007/03/04 06:02:43 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.63 2007/07/29 12:50:23 ad Exp $");
#include "opt_compat_freebsd.h" #include "opt_compat_freebsd.h"
#include "opt_compat_netbsd.h" #include "opt_compat_netbsd.h"
@ -240,7 +240,7 @@ scsistrategy(struct buf *bp)
printf("scsistrategy: " printf("scsistrategy: "
"No matching ioctl request found in queue\n"); "No matching ioctl request found in queue\n");
error = EINVAL; error = EINVAL;
goto bad; goto done;
} }
screq = &si->si_screq; screq = &si->si_screq;
periph = si->si_periph; periph = si->si_periph;
@ -253,19 +253,19 @@ scsistrategy(struct buf *bp)
scsipi_printaddr(periph); scsipi_printaddr(periph);
printf("physio split the request.. cannot proceed\n"); printf("physio split the request.. cannot proceed\n");
error = EIO; error = EIO;
goto bad; goto done;
} }
if (screq->timeout == 0) { if (screq->timeout == 0) {
error = EINVAL; error = EINVAL;
goto bad; goto done;
} }
if (screq->cmdlen > sizeof(struct scsipi_generic)) { if (screq->cmdlen > sizeof(struct scsipi_generic)) {
scsipi_printaddr(periph); scsipi_printaddr(periph);
printf("cmdlen too big\n"); printf("cmdlen too big\n");
error = EFAULT; error = EFAULT;
goto bad; goto done;
} }
if ((screq->flags & SCCMD_READ) && screq->datalen > 0) if ((screq->flags & SCCMD_READ) && screq->datalen > 0)
@ -282,11 +282,8 @@ scsistrategy(struct buf *bp)
0, /* user must do the retries *//* ignored */ 0, /* user must do the retries *//* ignored */
screq->timeout, bp, flags | XS_CTL_USERCMD); screq->timeout, bp, flags | XS_CTL_USERCMD);
bad: done:
if (error) { bp->b_error = error;
bp->b_flags |= B_ERROR;
bp->b_error = error;
}
biodone(bp); biodone(bp);
return; return;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd.c,v 1.263 2007/07/21 19:51:48 ad Exp $ */ /* $NetBSD: sd.c,v 1.264 2007/07/29 12:50:23 ad Exp $ */
/*- /*-
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@ -54,7 +54,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.263 2007/07/21 19:51:48 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.264 2007/07/29 12:50:23 ad Exp $");
#include "opt_scsi.h" #include "opt_scsi.h"
#include "rnd.h" #include "rnd.h"
@ -672,7 +672,7 @@ sdstrategy(struct buf *bp)
bp->b_error = EIO; bp->b_error = EIO;
else else
bp->b_error = ENODEV; bp->b_error = ENODEV;
goto bad; goto done;
} }
lp = sd->sc_dk.dk_label; lp = sd->sc_dk.dk_label;
@ -688,7 +688,7 @@ sdstrategy(struct buf *bp)
} }
if (!sector_aligned || bp->b_blkno < 0) { if (!sector_aligned || bp->b_blkno < 0) {
bp->b_error = EINVAL; bp->b_error = EINVAL;
goto bad; goto done;
} }
/* /*
* If it's a null transfer, return immediatly * If it's a null transfer, return immediatly
@ -745,8 +745,6 @@ sdstrategy(struct buf *bp)
splx(s); splx(s);
return; return;
bad:
bp->b_flags |= B_ERROR;
done: done:
/* /*
* Correctly set the buf to indicate a completed xfer * Correctly set the buf to indicate a completed xfer
@ -809,7 +807,6 @@ sdstart(struct scsipi_periph *periph)
(periph->periph_flags & PERIPH_MEDIA_LOADED) == 0)) { (periph->periph_flags & PERIPH_MEDIA_LOADED) == 0)) {
if ((bp = BUFQ_GET(sd->buf_queue)) != NULL) { if ((bp = BUFQ_GET(sd->buf_queue)) != NULL) {
bp->b_error = EIO; bp->b_error = EIO;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
biodone(bp); biodone(bp);
continue; continue;
@ -944,8 +941,7 @@ sddone(struct scsipi_xfer *xs, int error)
bp->b_resid = xs->resid; bp->b_resid = xs->resid;
if (error) { if (error) {
/* on a read/write error bp->b_resid is zero, so fix */ /* on a read/write error bp->b_resid is zero, so fix */
bp->b_resid =bp->b_bcount; bp->b_resid = bp->b_bcount;
bp->b_flags |= B_ERROR;
} }
disk_unbusy(&sd->sc_dk, bp->b_bcount - bp->b_resid, disk_unbusy(&sd->sc_dk, bp->b_bcount - bp->b_resid,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ss.c,v 1.71 2007/07/09 21:01:22 ad Exp $ */ /* $NetBSD: ss.c,v 1.72 2007/07/29 12:50:23 ad Exp $ */
/* /*
* Copyright (c) 1995 Kenneth Stailey. All rights reserved. * Copyright (c) 1995 Kenneth Stailey. All rights reserved.
@ -31,7 +31,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ss.c,v 1.71 2007/07/09 21:01:22 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: ss.c,v 1.72 2007/07/29 12:50:23 ad Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -411,7 +411,6 @@ ssstrategy(struct buf *bp)
* If the device has been made invalid, error out * If the device has been made invalid, error out
*/ */
if (!device_is_active(&ss->sc_dev)) { if (!device_is_active(&ss->sc_dev)) {
bp->b_flags |= B_ERROR;
if (periph->periph_flags & PERIPH_OPEN) if (periph->periph_flags & PERIPH_OPEN)
bp->b_error = EIO; bp->b_error = EIO;
else else
@ -421,7 +420,6 @@ ssstrategy(struct buf *bp)
/* If negative offset, error */ /* If negative offset, error */
if (bp->b_blkno < 0) { if (bp->b_blkno < 0) {
bp->b_flags |= B_ERROR;
bp->b_error = EINVAL; bp->b_error = EINVAL;
goto done; goto done;
} }
@ -525,8 +523,6 @@ ssdone(struct scsipi_xfer *xs, int error)
if (bp) { if (bp) {
bp->b_error = error; bp->b_error = error;
bp->b_resid = xs->resid; bp->b_resid = xs->resid;
if (error)
bp->b_flags |= B_ERROR;
biodone(bp); biodone(bp);
} }
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: st.c,v 1.197 2007/07/09 21:01:22 ad Exp $ */ /* $NetBSD: st.c,v 1.198 2007/07/29 12:50:23 ad Exp $ */
/*- /*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@ -57,7 +57,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.197 2007/07/09 21:01:22 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: st.c,v 1.198 2007/07/29 12:50:23 ad Exp $");
#include "opt_scsi.h" #include "opt_scsi.h"
@ -1090,7 +1090,7 @@ ststrategy(struct buf *bp)
/* If offset is negative, error */ /* If offset is negative, error */
if (bp->b_blkno < 0) { if (bp->b_blkno < 0) {
bp->b_error = EINVAL; bp->b_error = EINVAL;
goto bad; goto done;
} }
/* /*
@ -1101,7 +1101,7 @@ ststrategy(struct buf *bp)
printf("%s: bad request, must be multiple of %d\n", printf("%s: bad request, must be multiple of %d\n",
st->sc_dev.dv_xname, st->blksize); st->sc_dev.dv_xname, st->blksize);
bp->b_error = EIO; bp->b_error = EIO;
goto bad; goto done;
} }
} }
/* /*
@ -1112,7 +1112,7 @@ ststrategy(struct buf *bp)
printf("%s: bad request, must be between %d and %d\n", printf("%s: bad request, must be between %d and %d\n",
st->sc_dev.dv_xname, st->blkmin, st->blkmax); st->sc_dev.dv_xname, st->blkmin, st->blkmax);
bp->b_error = EIO; bp->b_error = EIO;
goto bad; goto done;
} }
s = splbio(); s = splbio();
@ -1132,8 +1132,6 @@ ststrategy(struct buf *bp)
splx(s); splx(s);
return; return;
bad:
bp->b_flags |= B_ERROR;
done: done:
/* /*
* Correctly set the buf to indicate a completed xfer * Correctly set the buf to indicate a completed xfer
@ -1188,7 +1186,6 @@ ststart(struct scsipi_periph *periph)
if ((bp = BUFQ_GET(st->buf_queue)) != NULL) { if ((bp = BUFQ_GET(st->buf_queue)) != NULL) {
/* make sure that one implies the other.. */ /* make sure that one implies the other.. */
periph->periph_flags &= ~PERIPH_MEDIA_LOADED; periph->periph_flags &= ~PERIPH_MEDIA_LOADED;
bp->b_flags |= B_ERROR;
bp->b_error = EIO; bp->b_error = EIO;
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
biodone(bp); biodone(bp);
@ -1221,7 +1218,6 @@ ststart(struct scsipi_periph *periph)
*/ */
if (st_space(st, 0, SP_FILEMARKS, 0)) { if (st_space(st, 0, SP_FILEMARKS, 0)) {
BUFQ_GET(st->buf_queue); BUFQ_GET(st->buf_queue);
bp->b_flags |= B_ERROR;
bp->b_error = EIO; bp->b_error = EIO;
biodone(bp); biodone(bp);
continue; continue;
@ -1230,7 +1226,6 @@ ststart(struct scsipi_periph *periph)
BUFQ_GET(st->buf_queue); BUFQ_GET(st->buf_queue);
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
bp->b_error = 0; bp->b_error = 0;
bp->b_flags &= ~B_ERROR;
st->flags &= ~ST_AT_FILEMARK; st->flags &= ~ST_AT_FILEMARK;
biodone(bp); biodone(bp);
continue; /* seek more work */ continue; /* seek more work */
@ -1244,10 +1239,8 @@ ststart(struct scsipi_periph *periph)
if (st->flags & (ST_EOM_PENDING|ST_EIO_PENDING)) { if (st->flags & (ST_EOM_PENDING|ST_EIO_PENDING)) {
BUFQ_GET(st->buf_queue); BUFQ_GET(st->buf_queue);
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
if (st->flags & ST_EIO_PENDING) { if (st->flags & ST_EIO_PENDING)
bp->b_error = EIO; bp->b_error = EIO;
bp->b_flags |= B_ERROR;
}
st->flags &= ~(ST_EOM_PENDING|ST_EIO_PENDING); st->flags &= ~(ST_EOM_PENDING|ST_EIO_PENDING);
biodone(bp); biodone(bp);
continue; /* seek more work */ continue; /* seek more work */
@ -1333,8 +1326,6 @@ stdone(struct scsipi_xfer *xs, int error)
if (bp) { if (bp) {
bp->b_error = error; bp->b_error = error;
bp->b_resid = xs->resid; bp->b_resid = xs->resid;
if (error)
bp->b_flags |= B_ERROR;
if ((bp->b_flags & B_READ) == B_WRITE) if ((bp->b_flags & B_READ) == B_WRITE)
st->flags |= ST_WRITTEN; st->flags |= ST_WRITTEN;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vnd.c,v 1.168 2007/07/09 21:00:29 ad Exp $ */ /* $NetBSD: vnd.c,v 1.169 2007/07/29 12:50:18 ad Exp $ */
/*- /*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -137,7 +137,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.168 2007/07/09 21:00:29 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.169 2007/07/29 12:50:18 ad Exp $");
#if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT)
#include "fs_nfs.h" #include "fs_nfs.h"
@ -454,7 +454,7 @@ vndstrategy(struct buf *bp)
if ((vnd->sc_flags & VNF_INITED) == 0) { if ((vnd->sc_flags & VNF_INITED) == 0) {
bp->b_error = ENXIO; bp->b_error = ENXIO;
goto bad; goto done;
} }
/* /*
@ -462,7 +462,7 @@ vndstrategy(struct buf *bp)
*/ */
if ((bp->b_bcount % lp->d_secsize) != 0) { if ((bp->b_bcount % lp->d_secsize) != 0) {
bp->b_error = EINVAL; bp->b_error = EINVAL;
goto bad; goto done;
} }
/* /*
@ -470,7 +470,7 @@ vndstrategy(struct buf *bp)
*/ */
if ((vnd->sc_flags & VNF_READONLY) && !(bp->b_flags & B_READ)) { if ((vnd->sc_flags & VNF_READONLY) && !(bp->b_flags & B_READ)) {
bp->b_error = EACCES; bp->b_error = EACCES;
goto bad; goto done;
} }
/* If it's a nil transfer, wake up the top half now. */ /* If it's a nil transfer, wake up the top half now. */
@ -520,8 +520,6 @@ vndstrategy(struct buf *bp)
splx(s); splx(s);
return; return;
bad:
bp->b_flags |= B_ERROR;
done: done:
bp->b_resid = bp->b_bcount; bp->b_resid = bp->b_bcount;
biodone(bp); biodone(bp);
@ -579,7 +577,6 @@ vndthread(void *arg)
if (vnd->sc_vp->v_mount == NULL) { if (vnd->sc_vp->v_mount == NULL) {
obp->b_error = ENXIO; obp->b_error = ENXIO;
obp->b_flags |= B_ERROR;
goto done; goto done;
} }
#ifdef VND_COMPRESSION #ifdef VND_COMPRESSION
@ -701,10 +698,6 @@ handle_with_rdwr(struct vnd_softc *vnd, const struct buf *obp, struct buf *bp)
vp, bp->b_data, bp->b_bcount, offset, vp, bp->b_data, bp->b_bcount, offset,
UIO_SYSSPACE, 0, vnd->sc_cred, &resid, NULL); UIO_SYSSPACE, 0, vnd->sc_cred, &resid, NULL);
bp->b_resid = resid; bp->b_resid = resid;
if (bp->b_error != 0)
bp->b_flags |= B_ERROR;
else
KASSERT(!(bp->b_flags & B_ERROR));
/* We need to increase the number of outputs on the vnode if /* We need to increase the number of outputs on the vnode if
* there was any write to it. */ * there was any write to it. */
@ -827,7 +820,7 @@ vndiodone(struct buf *bp)
#ifdef DEBUG #ifdef DEBUG
if (vnddebug & VDB_IO) { if (vnddebug & VDB_IO) {
printf("vndiodone1: bp %p iodone: error %d\n", printf("vndiodone1: bp %p iodone: error %d\n",
bp, (bp->b_flags & B_ERROR) != 0 ? bp->b_error : 0); bp, bp->b_error);
} }
#endif #endif
disk_unbusy(&vnd->sc_dkdev, bp->b_bcount - bp->b_resid, disk_unbusy(&vnd->sc_dkdev, bp->b_bcount - bp->b_resid,
@ -836,7 +829,6 @@ vndiodone(struct buf *bp)
if (vnd->sc_active == 0) { if (vnd->sc_active == 0) {
wakeup(&vnd->sc_tab); wakeup(&vnd->sc_tab);
} }
obp->b_flags |= bp->b_flags & B_ERROR;
obp->b_error = bp->b_error; obp->b_error = bp->b_error;
obp->b_resid = bp->b_resid; obp->b_resid = bp->b_resid;
VND_PUTXFER(vnd, vnx); VND_PUTXFER(vnd, vnx);
@ -1750,7 +1742,6 @@ compstrategy(struct buf *bp, off_t bn)
/* check for good block number */ /* check for good block number */
if (comp_block >= vnd->sc_comp_numoffs) { if (comp_block >= vnd->sc_comp_numoffs) {
bp->b_error = EINVAL; bp->b_error = EINVAL;
bp->b_flags |= B_ERROR;
splx(s); splx(s);
return; return;
} }
@ -1765,7 +1756,6 @@ compstrategy(struct buf *bp, off_t bn)
UIO_SYSSPACE, IO_UNIT, vnd->sc_cred, NULL, NULL); UIO_SYSSPACE, IO_UNIT, vnd->sc_cred, NULL, NULL);
if (error) { if (error) {
bp->b_error = error; bp->b_error = error;
bp->b_flags |= B_ERROR;
VOP_UNLOCK(vnd->sc_vp, 0); VOP_UNLOCK(vnd->sc_vp, 0);
splx(s); splx(s);
return; return;
@ -1783,7 +1773,6 @@ compstrategy(struct buf *bp, off_t bn)
vnd->sc_dev.dv_xname, vnd->sc_dev.dv_xname,
vnd->sc_comp_stream.msg); vnd->sc_comp_stream.msg);
bp->b_error = EBADMSG; bp->b_error = EBADMSG;
bp->b_flags |= B_ERROR;
VOP_UNLOCK(vnd->sc_vp, 0); VOP_UNLOCK(vnd->sc_vp, 0);
splx(s); splx(s);
return; return;
@ -1807,7 +1796,6 @@ compstrategy(struct buf *bp, off_t bn)
length_in_buffer, &auio); length_in_buffer, &auio);
if (error) { if (error) {
bp->b_error = error; bp->b_error = error;
bp->b_flags |= B_ERROR;
splx(s); splx(s);
return; return;
} }