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.
@ -45,7 +45,7 @@
*/
#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"
@ -456,7 +456,7 @@ ld_ataraid_iodone_raid0(struct buf *vbp)
/* You are alone */
other_cbp->cb_other = NULL;
if (cbp->cb_buf.b_flags & B_ERROR) {
if (cbp->cb_buf.b_error != 0) {
/*
* 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
* 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 &&
(aai->aai_level & AAI_L_RAID1) != 0 &&
cbp->cb_comp < aai->aai_width) {
cbp->cb_comp += aai->aai_width;
adi = &aai->aai_disks[cbp->cb_comp];
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);
goto out;
}
@ -492,7 +492,6 @@ ld_ataraid_iodone_raid0(struct buf *vbp)
*/
;
else {
bp->b_flags |= B_ERROR;
bp->b_error = cbp->cb_buf.b_error ?
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.
@ -66,7 +66,7 @@
*/
#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"
@ -522,13 +522,13 @@ wdstrategy(struct buf *bp)
(bp->b_bcount % lp->d_secsize) != 0 ||
(bp->b_bcount / lp->d_secsize) >= (1 << NBBY)) {
bp->b_error = EINVAL;
goto bad;
goto done;
}
/* If device invalidated (e.g. media change, door open), error. */
if ((wd->sc_flags & WDF_LOADED) == 0) {
bp->b_error = EIO;
goto bad;
goto done;
}
/* If it's a null transfer, return immediately. */
@ -591,8 +591,6 @@ wdstrategy(struct buf *bp)
wdstart(wd);
splx(s);
return;
bad:
bp->b_flags |= B_ERROR;
done:
/* Toss transfer; we're done early. */
bp->b_resid = bp->b_bcount;
@ -632,7 +630,7 @@ wd_split_mod15_write(struct buf *bp)
struct buf *obp = bp->b_private;
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
* the original transfer, make sure to account for that
@ -661,7 +659,6 @@ wd_split_mod15_write(struct buf *bp)
return;
done:
obp->b_flags |= bp->b_flags & B_ERROR;
obp->b_error = bp->b_error;
obp->b_resid = bp->b_resid;
putiobuf(bp);
@ -693,7 +690,6 @@ __wdstart(struct wd_softc *wd, struct buf *bp)
if (__predict_false(nbp == NULL)) {
/* No memory -- fail the iop. */
bp->b_error = ENOMEM;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
biodone(bp);
wd->openings++;
@ -829,7 +825,6 @@ retry2:
wd->sc_bscount++;
}
#endif
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
break;
case NOERROR:
@ -838,7 +833,6 @@ noerror: if ((wd->sc_wdc_bio.flags & ATA_CORR) || wd->retries > 0)
wd->sc_dev.dv_xname);
break;
case ERR_NODEV:
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
break;
}
@ -2005,7 +1999,7 @@ wdioctlstrategy(struct buf *bp)
printf("wdioctlstrategy: "
"No matching ioctl request found in queue\n");
error = EINVAL;
goto bad;
goto done;
}
memset(&ata_c, 0, sizeof(ata_c));
@ -2017,7 +2011,7 @@ wdioctlstrategy(struct buf *bp)
if (bp->b_bcount != wi->wi_atareq.datalen) {
printf("physio split wd ioctl request... cannot proceed\n");
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) >=
(1 << NBBY)) {
error = EINVAL;
goto bad;
goto done;
}
/*
@ -2038,7 +2032,7 @@ wdioctlstrategy(struct buf *bp)
if (wi->wi_atareq.timeout == 0) {
error = EINVAL;
goto bad;
goto done;
}
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)
!= ATACMD_COMPLETE) {
wi->wi_atareq.retsts = ATACMD_ERROR;
goto bad;
error = EIO;
goto done;
}
if (ata_c.flags & (AT_ERROR | AT_TIMEOU | AT_DF)) {
@ -2089,11 +2084,7 @@ wdioctlstrategy(struct buf *bp)
}
}
bp->b_error = 0;
biodone(bp);
return;
bad:
bp->b_flags |= B_ERROR;
done:
bp->b_error = error;
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.
@ -125,7 +125,7 @@
*/
#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/systm.h>
@ -671,7 +671,6 @@ ccdstrategy(struct buf *bp)
printf("ccdstrategy: unit %d: not inited\n", unit);
#endif
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
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.
*/
if (bp->b_flags & B_ERROR)
if (bp->b_error != 0)
bp->b_resid = bp->b_bcount;
disk_unbusy(&cs->sc_dkdev, (bp->b_bcount - bp->b_resid),
(bp->b_flags & B_READ));
@ -920,11 +919,8 @@ ccdiodone(struct buf *vbp)
}
#endif
if (cbp->cb_buf.b_flags & B_ERROR) {
bp->b_flags |= B_ERROR;
bp->b_error = cbp->cb_buf.b_error ?
cbp->cb_buf.b_error : EIO;
if (cbp->cb_buf.b_error != 0) {
bp->b_error = cbp->cb_buf.b_error;
printf("%s: error %d on component %d\n",
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.
@ -37,7 +37,7 @@
*/
#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/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",
nbp->b_dev, nbp, nbp->b_blkno, nbp->b_data,
nbp->b_bcount));
if (nbp->b_flags & B_ERROR) {
obp->b_flags |= B_ERROR;
obp->b_error = nbp->b_error ? nbp->b_error : EIO;
if (nbp->b_error != 0) {
obp->b_error = nbp->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 */
obp->b_resid = 0;
if (obp->b_flags & B_ERROR)
if (obp->b_error != 0)
obp->b_resid = obp->b_bcount;
disk_unbusy(&dksc->sc_dkdev, obp->b_bcount - obp->b_resid,
(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.
@ -37,7 +37,7 @@
*/
#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/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)) {
DPRINTF_FOLLOW(("dk_strategy: not inited\n"));
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
biodone(bp);
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.
@ -37,7 +37,7 @@
*/
#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"
@ -999,7 +999,6 @@ dkstrategy(struct buf *bp)
if (sc->sc_state != DKW_STATE_RUNNING) {
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
goto done;
}
@ -1048,7 +1047,6 @@ dkstart(struct dkwedge_softc *sc)
wakeup(&sc->sc_iopend);
}
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
biodone(bp);
}
@ -1100,10 +1098,8 @@ dkiodone(struct buf *bp)
struct buf *obp = bp->b_private;
struct dkwedge_softc *sc = dkwedge_lookup(obp->b_dev);
if (bp->b_flags & B_ERROR) {
obp->b_flags |= B_ERROR;
if (bp->b_error != 0)
obp->b_error = bp->b_error;
}
obp->b_resid = bp->b_resid;
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.
@ -43,7 +43,7 @@
*/
#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"
@ -236,7 +236,6 @@ fss_strategy(struct buf *bp)
FSS_UNLOCK(sc, s);
bp->b_error = (sc == NULL ? ENODEV : EROFS);
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
biodone(bp);
return;
@ -823,7 +822,7 @@ fss_cluster_iodone(struct buf *bp)
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);
if (--scp->fc_xfercount == 0)
@ -1084,7 +1083,6 @@ fss_bs_thread(void *arg)
if (error) {
bp->b_error = error;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
} else
bp->b_resid = 0;
@ -1139,7 +1137,6 @@ fss_bs_thread(void *arg)
if (!FSS_ISVALID(sc)) {
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
biodone(bp);
continue;
@ -1169,7 +1166,6 @@ fss_bs_thread(void *arg)
if (biowait(nbp) != 0) {
bp->b_resid = bp->b_bcount;
bp->b_error = nbp->b_error;
bp->b_flags |= B_ERROR;
biodone(bp);
FSS_LOCK(sc, s);
continue;
@ -1227,7 +1223,6 @@ fss_bs_thread(void *arg)
off, len, addr)) != 0) {
bp->b_resid = bp->b_bcount;
bp->b_error = error;
bp->b_flags |= B_ERROR;
FSS_LOCK(sc, s);
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.
@ -43,7 +43,7 @@
*/
#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"
@ -505,7 +505,6 @@ ld_iop_intr(struct device *dv, struct iop_msg *im, void *reply)
}
if (err) {
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
bp->b_resid = bp->b_bcount;
} 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.
@ -37,7 +37,7 @@
*/
#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"
@ -330,7 +330,6 @@ ld_aac_intr(struct aac_ccb *ac)
aac_ccb_free(aac, ac);
if (status != ST_OK) {
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
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.
@ -41,7 +41,7 @@
*/
#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"
@ -220,7 +220,6 @@ ld_cac_done(struct device *dv, void *context, int error)
}
if (rv) {
bp->b_flags |= B_ERROR;
bp->b_error = rv;
bp->b_resid = bp->b_bcount;
} 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.
@ -41,7 +41,7 @@
*/
#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"
@ -316,7 +316,6 @@ ld_icp_intr(struct icp_ccb *ic)
if (ic->ic_status != ICP_S_OK) {
printf("%s: request failed; status=0x%04x\n",
ic->ic_dv->dv_xname, ic->ic_status);
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
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.
@ -41,7 +41,7 @@
*/
#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"
@ -237,7 +237,6 @@ ld_mlx_handler(struct mlx_ccb *mc)
mlx = (struct mlx_softc *)device_parent(&sc->sc_ld.sc_dv);
if (mc->mc_status != MLX_STATUS_OK) {
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
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.
@ -42,7 +42,7 @@
*/
#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"
@ -1326,7 +1326,6 @@ esh_fpstrategy(bp)
s = splnet();
if (sc == NULL || ulp == HIPPI_ULP_802) {
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
goto done;
}
@ -1337,7 +1336,6 @@ esh_fpstrategy(bp)
if ((sc->sc_flags & UP_FLAGS) != UP_FLAGS) {
bp->b_error = EBUSY;
bp->b_flags |= B_ERROR;
goto done;
}
#undef UP_FLAGS
@ -1353,7 +1351,6 @@ esh_fpstrategy(bp)
if (di == NULL) {
bp->b_error = ENOMEM;
bp->b_flags |= B_ERROR;
goto done;
}
di->ed_buf = bp;
@ -1367,7 +1364,6 @@ esh_fpstrategy(bp)
"failed\terror code %d\n",
sc->sc_dev.dv_xname, error);
bp->b_error = ENOBUFS;
bp->b_flags |= B_ERROR;
esh_free_dmainfo(sc, di);
goto done;
}
@ -2715,7 +2711,6 @@ esh_read_fp_ring(sc, consumer, error, ulp)
di->ed_buf->b_resid =
di->ed_buf->b_bcount;
di->ed_buf->b_error = EIO;
di->ed_buf->b_flags |= B_ERROR;
} else {
di->ed_error = EIO;
recv->ec_error = 0;
@ -3380,7 +3375,6 @@ eshstop(sc)
bp->b_resid = bp->b_bcount;
bp->b_error = EIO;
bp->b_flags |= B_ERROR;
biodone(bp);
} else if (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.
@ -88,7 +88,7 @@
*/
#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 "opt_ddb.h"
@ -590,7 +590,7 @@ fdstrategy(bp)
((bp->b_bcount % FDC_BSIZE) != 0 &&
(bp->b_flags & B_FORMAT) == 0)) {
bp->b_error = EINVAL;
goto bad;
goto done;
}
/* If it's a null transfer, return immediately. */
@ -608,7 +608,7 @@ fdstrategy(bp)
if (sz < 0) {
/* If past end of disk, return EINVAL. */
bp->b_error = EINVAL;
goto bad;
goto done;
}
/* Otherwise, truncate request. */
bp->b_bcount = sz << DEV_BSHIFT;
@ -642,8 +642,6 @@ fdstrategy(bp)
splx(s);
return;
bad:
bp->b_flags |= B_ERROR;
done:
/* Toss transfer; we're done early. */
bp->b_resid = bp->b_bcount;
@ -1294,7 +1292,6 @@ fdcretry(fdc)
fdc->sc_status[5]);
}
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
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.
@ -56,7 +56,7 @@
/*static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";*/
#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/systm.h>
@ -440,14 +440,14 @@ mcdstrategy(bp)
printf("%s: strategy: blkno = %" PRId64 " bcount = %d\n",
sc->sc_dev.dv_xname, bp->b_blkno, bp->b_bcount);
bp->b_error = EINVAL;
goto bad;
goto done;
}
/* If device invalidated (e.g. media change, door open), error. */
if ((sc->flags & MCDF_LOADED) == 0) {
MCD_TRACE("strategy: drive not valid%s", "\n");
bp->b_error = EIO;
goto bad;
goto done;
}
/* No data to read. */
@ -481,8 +481,6 @@ mcdstrategy(bp)
mcdstart(sc);
return;
bad:
bp->b_flags |= B_ERROR;
done:
bp->b_resid = bp->b_bcount;
biodone(bp);
@ -513,7 +511,6 @@ loop:
if ((sc->flags & MCDF_LOADED) == 0) {
MCD_TRACE("start: drive not valid%s", "\n");
bp->b_error = EIO;
bp->b_flags |= B_ERROR;
biodone(bp);
goto loop;
}
@ -1324,7 +1321,7 @@ readerr:
changed:
/* Invalidate the buffer. */
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
bp->b_resid = bp->b_bcount - mbx->skip;
disk_unbusy(&sc->sc_dk, (bp->b_bcount - bp->b_resid),
(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.
@ -51,7 +51,7 @@
*/
#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/systm.h>
@ -648,7 +648,6 @@ wtstrategy(struct buf *bp)
if (sc->flags & TPEXCEP) {
errxit:
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
}
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.
@ -41,7 +41,7 @@
*/
#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"
@ -551,7 +551,7 @@ ldstrategy(struct buf *bp)
if ((sc->sc_flags & LDF_DETACH) != 0) {
bp->b_error = EIO;
goto bad;
goto done;
}
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) {
bp->b_error = EINVAL;
goto bad;
goto done;
}
/* If it's a null transfer, return immediately. */
@ -600,8 +600,6 @@ ldstrategy(struct buf *bp)
splx(s);
return;
bad:
bp->b_flags |= B_ERROR;
done:
bp->b_resid = bp->b_bcount;
biodone(bp);
@ -647,7 +645,6 @@ ldstart(struct ld_softc *sc, struct buf *bp)
} else {
(void) BUFQ_GET(sc->sc_bufq);
bp->b_error = error;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
mutex_exit(&sc->sc_mutex);
biodone(bp);
@ -663,7 +660,7 @@ void
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);
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.
@ -38,7 +38,7 @@
*/
#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"
@ -217,13 +217,13 @@ edmcastrategy(bp)
(bp->b_bcount % lp->d_secsize) != 0 ||
(bp->b_bcount / lp->d_secsize) >= (1 << NBBY)) {
bp->b_error = EINVAL;
goto bad;
goto done;
}
/* If device invalidated (e.g. media change, door open), error. */
if ((ed->sc_flags & WDF_LOADED) == 0) {
bp->b_error = EIO;
goto bad;
goto done;
}
/* If it's a null transfer, return immediately. */
@ -262,8 +262,6 @@ edmcastrategy(bp)
wakeup_one(ed->edc_softc);
return;
bad:
bp->b_flags |= B_ERROR;
done:
/* Toss transfer; we're done early. */
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.
@ -50,7 +50,7 @@
*/
#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"
@ -845,7 +845,6 @@ edcworker(void *arg)
if (error) {
bp->b_error = error;
bp->b_flags |= B_ERROR;
} else {
/* Set resid, most commonly to zero. */
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.
@ -46,7 +46,7 @@
*/
#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"
@ -319,7 +319,6 @@ mdstrategy(struct buf *bp)
if (sc->sc_type == MD_UNCONFIGURED) {
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
goto done;
}
@ -359,7 +358,6 @@ mdstrategy(struct buf *bp)
bp->b_resid = bp->b_bcount;
set_eio:
bp->b_error = EIO;
bp->b_flags |= B_ERROR;
break;
}
done:
@ -508,7 +506,6 @@ md_server_loop(struct md_softc *sc)
done:
if (error) {
bp->b_error = error;
bp->b_flags |= B_ERROR;
}
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.
@ -41,7 +41,7 @@
*/
#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"
@ -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,
ac->ac_status);
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
bp->b_resid = bp->b_bcount;
} else

View File

@ -1,5 +1,5 @@
/* $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.
@ -43,7 +43,7 @@
*/
#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"
@ -224,7 +224,6 @@ ld_twa_handler(struct twa_request *tr)
status = tr->tr_command->command.cmd_pkt_9k.status;
if (status != 0) {
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
bp->b_resid = bp->b_bcount;
} 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.
@ -41,7 +41,7 @@
*/
#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"
@ -264,7 +264,6 @@ ld_twe_handler(struct twe_ccb *ccb, int error)
twe_ccb_free(twe, ccb);
if (error) {
bp->b_flags |= B_ERROR;
bp->b_error = error;
bp->b_resid = bp->b_bcount;
} 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.
* All rights reserved.
@ -146,7 +146,7 @@
***********************************************************/
#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/errno.h>
@ -747,18 +747,15 @@ raidstrategy(struct buf *bp)
if ((rs->sc_flags & RAIDF_INITED) ==0) {
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
goto done;
}
if (raidID >= numraid || !raidPtrs[raidID]) {
bp->b_error = ENODEV;
bp->b_flags |= B_ERROR;
goto done;
}
raidPtr = raidPtrs[raidID];
if (!raidPtr->valid) {
bp->b_error = ENODEV;
bp->b_flags |= B_ERROR;
goto done;
}
if (bp->b_bcount == 0) {
@ -1861,7 +1858,6 @@ raidstart(RF_Raid_t *raidPtr)
if ((sum > raidPtr->totalSectors) || (sum < raid_addr)
|| (sum < num_blocks) || (sum < pb)) {
bp->b_error = ENOSPC;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
biodone(bp);
RF_LOCK_MUTEX(raidPtr->mutex);
@ -1873,7 +1869,6 @@ raidstart(RF_Raid_t *raidPtr)
if (bp->b_bcount & raidPtr->sectorMask) {
bp->b_error = EINVAL;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
biodone(bp);
RF_LOCK_MUTEX(raidPtr->mutex);
@ -1907,7 +1902,6 @@ raidstart(RF_Raid_t *raidPtr)
if (rc) {
bp->b_error = rc;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
biodone(bp);
/* continue loop */
@ -2025,10 +2019,10 @@ KernelWakeupFunc(struct buf *bp)
}
#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... */
if (bp->b_flags & B_ERROR) {
if (bp->b_error != 0) {
/* Mark the disk as dead */
/* but only mark it once... */
/* and only if it wouldn't leave this RAID set
@ -2055,7 +2049,7 @@ KernelWakeupFunc(struct buf *bp)
/* 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);

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.
* All rights reserved.
@ -27,7 +27,7 @@
*/
#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>
@ -528,7 +528,6 @@ rf_State_CreateDAG(RF_RaidAccessDesc_t *desc)
/* skip straight to rf_State_Cleanup() */
desc->state = rf_CleanupState;
bp = (struct buf *)desc->bp;
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
} else {
/* 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.
@ -57,7 +57,7 @@
*/
#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"
@ -580,7 +580,7 @@ cdstrategy(struct buf *bp)
bp->b_error = EIO;
else
bp->b_error = ENODEV;
goto bad;
goto done;
}
lp = cd->sc_dk.dk_label;
@ -592,7 +592,7 @@ cdstrategy(struct buf *bp)
if ((bp->b_bcount % lp->d_secsize) != 0 ||
bp->b_blkno < 0 ) {
bp->b_error = EINVAL;
goto bad;
goto done;
}
/*
* If it's a null transfer, return immediately
@ -644,7 +644,7 @@ cdstrategy(struct buf *bp)
/* XXXX We don't support bouncing writes. */
bp->b_error = EACCES;
goto bad;
goto done;
}
count = ((blkno * lp->d_secsize) % cd->params.blksize);
/* XXX Store starting offset in bp->b_rawblkno */
@ -658,14 +658,14 @@ cdstrategy(struct buf *bp)
if (!nbp) {
/* No memory -- fail the iop. */
bp->b_error = ENOMEM;
goto bad;
goto done;
}
bounce = malloc(count, M_DEVBUF, M_NOWAIT);
if (!bounce) {
/* No memory -- fail the iop. */
putiobuf(nbp);
bp->b_error = ENOMEM;
goto bad;
goto done;
}
/* Set up the IOP to the bounce buffer. */
@ -715,8 +715,6 @@ cdstrategy(struct buf *bp)
splx(s);
return;
bad:
bp->b_flags |= B_ERROR;
done:
/*
* 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)) {
if ((bp = BUFQ_GET(cd->buf_queue)) != NULL) {
bp->b_error = EIO;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
biodone(bp);
continue;
@ -894,7 +891,6 @@ cddone(struct scsipi_xfer *xs, int 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(&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;
if (bp->b_flags & B_ERROR) {
if (bp->b_error != 0) {
/* EEK propagate the error and free the memory */
goto done;
}
@ -938,7 +934,6 @@ cdbounce(struct buf *bp)
nbp = getiobuf_nowait();
if (!nbp) {
/* No buf available. */
bp->b_flags |= B_ERROR;
bp->b_error = ENOMEM;
bp->b_resid = bp->b_bcount;
goto done;
@ -985,7 +980,6 @@ cdbounce(struct buf *bp)
}
}
done:
obp->b_flags |= bp->b_flags & B_ERROR;
obp->b_error = bp->b_error;
obp->b_resid = bp->b_resid;
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.
@ -44,7 +44,7 @@
*/
#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_netbsd.h"
@ -240,7 +240,7 @@ scsistrategy(struct buf *bp)
printf("scsistrategy: "
"No matching ioctl request found in queue\n");
error = EINVAL;
goto bad;
goto done;
}
screq = &si->si_screq;
periph = si->si_periph;
@ -253,19 +253,19 @@ scsistrategy(struct buf *bp)
scsipi_printaddr(periph);
printf("physio split the request.. cannot proceed\n");
error = EIO;
goto bad;
goto done;
}
if (screq->timeout == 0) {
error = EINVAL;
goto bad;
goto done;
}
if (screq->cmdlen > sizeof(struct scsipi_generic)) {
scsipi_printaddr(periph);
printf("cmdlen too big\n");
error = EFAULT;
goto bad;
goto done;
}
if ((screq->flags & SCCMD_READ) && screq->datalen > 0)
@ -282,11 +282,8 @@ scsistrategy(struct buf *bp)
0, /* user must do the retries *//* ignored */
screq->timeout, bp, flags | XS_CTL_USERCMD);
bad:
if (error) {
bp->b_flags |= B_ERROR;
bp->b_error = error;
}
done:
bp->b_error = error;
biodone(bp);
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.
@ -54,7 +54,7 @@
*/
#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 "rnd.h"
@ -672,7 +672,7 @@ sdstrategy(struct buf *bp)
bp->b_error = EIO;
else
bp->b_error = ENODEV;
goto bad;
goto done;
}
lp = sd->sc_dk.dk_label;
@ -688,7 +688,7 @@ sdstrategy(struct buf *bp)
}
if (!sector_aligned || bp->b_blkno < 0) {
bp->b_error = EINVAL;
goto bad;
goto done;
}
/*
* If it's a null transfer, return immediatly
@ -745,8 +745,6 @@ sdstrategy(struct buf *bp)
splx(s);
return;
bad:
bp->b_flags |= B_ERROR;
done:
/*
* 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)) {
if ((bp = BUFQ_GET(sd->buf_queue)) != NULL) {
bp->b_error = EIO;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
biodone(bp);
continue;
@ -944,8 +941,7 @@ sddone(struct scsipi_xfer *xs, int error)
bp->b_resid = xs->resid;
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;
bp->b_resid = bp->b_bcount;
}
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.
@ -31,7 +31,7 @@
*/
#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/systm.h>
@ -411,7 +411,6 @@ ssstrategy(struct buf *bp)
* If the device has been made invalid, error out
*/
if (!device_is_active(&ss->sc_dev)) {
bp->b_flags |= B_ERROR;
if (periph->periph_flags & PERIPH_OPEN)
bp->b_error = EIO;
else
@ -421,7 +420,6 @@ ssstrategy(struct buf *bp)
/* If negative offset, error */
if (bp->b_blkno < 0) {
bp->b_flags |= B_ERROR;
bp->b_error = EINVAL;
goto done;
}
@ -525,8 +523,6 @@ ssdone(struct scsipi_xfer *xs, int error)
if (bp) {
bp->b_error = error;
bp->b_resid = xs->resid;
if (error)
bp->b_flags |= B_ERROR;
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.
@ -57,7 +57,7 @@
*/
#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"
@ -1090,7 +1090,7 @@ ststrategy(struct buf *bp)
/* If offset is negative, error */
if (bp->b_blkno < 0) {
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",
st->sc_dev.dv_xname, st->blksize);
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",
st->sc_dev.dv_xname, st->blkmin, st->blkmax);
bp->b_error = EIO;
goto bad;
goto done;
}
s = splbio();
@ -1132,8 +1132,6 @@ ststrategy(struct buf *bp)
splx(s);
return;
bad:
bp->b_flags |= B_ERROR;
done:
/*
* 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) {
/* make sure that one implies the other.. */
periph->periph_flags &= ~PERIPH_MEDIA_LOADED;
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
bp->b_resid = bp->b_bcount;
biodone(bp);
@ -1221,7 +1218,6 @@ ststart(struct scsipi_periph *periph)
*/
if (st_space(st, 0, SP_FILEMARKS, 0)) {
BUFQ_GET(st->buf_queue);
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
biodone(bp);
continue;
@ -1230,7 +1226,6 @@ ststart(struct scsipi_periph *periph)
BUFQ_GET(st->buf_queue);
bp->b_resid = bp->b_bcount;
bp->b_error = 0;
bp->b_flags &= ~B_ERROR;
st->flags &= ~ST_AT_FILEMARK;
biodone(bp);
continue; /* seek more work */
@ -1244,10 +1239,8 @@ ststart(struct scsipi_periph *periph)
if (st->flags & (ST_EOM_PENDING|ST_EIO_PENDING)) {
BUFQ_GET(st->buf_queue);
bp->b_resid = bp->b_bcount;
if (st->flags & ST_EIO_PENDING) {
if (st->flags & ST_EIO_PENDING)
bp->b_error = EIO;
bp->b_flags |= B_ERROR;
}
st->flags &= ~(ST_EOM_PENDING|ST_EIO_PENDING);
biodone(bp);
continue; /* seek more work */
@ -1333,8 +1326,6 @@ stdone(struct scsipi_xfer *xs, int error)
if (bp) {
bp->b_error = error;
bp->b_resid = xs->resid;
if (error)
bp->b_flags |= B_ERROR;
if ((bp->b_flags & B_READ) == B_WRITE)
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.
@ -137,7 +137,7 @@
*/
#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)
#include "fs_nfs.h"
@ -454,7 +454,7 @@ vndstrategy(struct buf *bp)
if ((vnd->sc_flags & VNF_INITED) == 0) {
bp->b_error = ENXIO;
goto bad;
goto done;
}
/*
@ -462,7 +462,7 @@ vndstrategy(struct buf *bp)
*/
if ((bp->b_bcount % lp->d_secsize) != 0) {
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)) {
bp->b_error = EACCES;
goto bad;
goto done;
}
/* If it's a nil transfer, wake up the top half now. */
@ -520,8 +520,6 @@ vndstrategy(struct buf *bp)
splx(s);
return;
bad:
bp->b_flags |= B_ERROR;
done:
bp->b_resid = bp->b_bcount;
biodone(bp);
@ -579,7 +577,6 @@ vndthread(void *arg)
if (vnd->sc_vp->v_mount == NULL) {
obp->b_error = ENXIO;
obp->b_flags |= B_ERROR;
goto done;
}
#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,
UIO_SYSSPACE, 0, vnd->sc_cred, &resid, NULL);
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
* there was any write to it. */
@ -827,7 +820,7 @@ vndiodone(struct buf *bp)
#ifdef DEBUG
if (vnddebug & VDB_IO) {
printf("vndiodone1: bp %p iodone: error %d\n",
bp, (bp->b_flags & B_ERROR) != 0 ? bp->b_error : 0);
bp, bp->b_error);
}
#endif
disk_unbusy(&vnd->sc_dkdev, bp->b_bcount - bp->b_resid,
@ -836,7 +829,6 @@ vndiodone(struct buf *bp)
if (vnd->sc_active == 0) {
wakeup(&vnd->sc_tab);
}
obp->b_flags |= bp->b_flags & B_ERROR;
obp->b_error = bp->b_error;
obp->b_resid = bp->b_resid;
VND_PUTXFER(vnd, vnx);
@ -1750,7 +1742,6 @@ compstrategy(struct buf *bp, off_t bn)
/* check for good block number */
if (comp_block >= vnd->sc_comp_numoffs) {
bp->b_error = EINVAL;
bp->b_flags |= B_ERROR;
splx(s);
return;
}
@ -1765,7 +1756,6 @@ compstrategy(struct buf *bp, off_t bn)
UIO_SYSSPACE, IO_UNIT, vnd->sc_cred, NULL, NULL);
if (error) {
bp->b_error = error;
bp->b_flags |= B_ERROR;
VOP_UNLOCK(vnd->sc_vp, 0);
splx(s);
return;
@ -1783,7 +1773,6 @@ compstrategy(struct buf *bp, off_t bn)
vnd->sc_dev.dv_xname,
vnd->sc_comp_stream.msg);
bp->b_error = EBADMSG;
bp->b_flags |= B_ERROR;
VOP_UNLOCK(vnd->sc_vp, 0);
splx(s);
return;
@ -1807,7 +1796,6 @@ compstrategy(struct buf *bp, off_t bn)
length_in_buffer, &auio);
if (error) {
bp->b_error = error;
bp->b_flags |= B_ERROR;
splx(s);
return;
}