summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-10-12 02:02:03 +0000
committerjulian <julian@FreeBSD.org>1995-10-12 02:02:03 +0000
commit8481e93a3a803f40e280c5db504eab5bdf774c64 (patch)
tree44daeb2ea32052b14579455742896990e43b178f
parentd2a3a19deaa5549ce0129d0696258eb206c36dd9 (diff)
downloadFreeBSD-src-8481e93a3a803f40e280c5db504eab5bdf774c64.zip
FreeBSD-src-8481e93a3a803f40e280c5db504eab5bdf774c64.tar.gz
Ack!
sometime around 1.51, the check for minphys dissappeared out of transfers for disks.. we weren't hecking that the adapter could handle a transfer of the size we were requesting.. Peter!? :) this explains the rash of failures I've seen reported recently with "too many DMA segments" on raw devices (added one for st as well)
-rw-r--r--sys/scsi/sd.c21
-rw-r--r--sys/scsi/st.c28
2 files changed, 34 insertions, 15 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 71333cc..14438c9 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
*
- * $Id: sd.c,v 1.65 1995/05/30 08:13:51 rgrimes Exp $
+ * $Id: sd.c,v 1.66 1995/08/07 11:56:31 davidg Exp $
*/
#define SPLSD splbio
@@ -93,18 +93,18 @@ SCSI_DEVICE_ENTRIES(sd)
struct scsi_device sd_switch =
{
- sd_sense_handler,
- sdstart, /* have a queue, served by this */
- NULL, /* have no async handler */
- NULL, /* Use default 'done' routine */
- "sd",
- 0,
+ sd_sense_handler,
+ sdstart, /* have a queue, served by this */
+ NULL, /* have no async handler */
+ NULL, /* Use default 'done' routine */
+ "sd",
+ 0,
{0, 0},
0, /* Link flags */
sdattach,
"Direct-Access",
sdopen,
- sizeof(struct scsi_data),
+ sizeof(struct scsi_data),
T_DIRECT,
sdunit,
sdsetunit,
@@ -374,6 +374,11 @@ sd_strategy(struct buf *bp, struct scsi_link *sc_link)
}
/*
+ * check it's not too big a transfer for our adapter
+ */
+ scsi_minphys(bp,&sd_switch);
+
+ /*
* Odd number of bytes
*/
if (bp->b_bcount % DEV_BSIZE != 0) {
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index 7f56769..b59c9e2 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
- * $Id: st.c,v 1.37 1995/07/09 08:14:24 joerg Exp $
+ * $Id: st.c,v 1.38 1995/07/16 09:13:14 gibbs Exp $
*/
/*
@@ -904,6 +904,7 @@ st_strategy(struct buf *bp, struct scsi_link *sc_link)
unsigned char unit; /* XXX Everywhere else unit is "u_int32". Please int? */
u_int32 opri;
struct scsi_data *st;
+ int len;
ststrats++;
unit = STUNIT((bp->b_dev));
@@ -911,10 +912,14 @@ st_strategy(struct buf *bp, struct scsi_link *sc_link)
/*
* If it's a null transfer, return immediatly
*/
- if (bp->b_bcount == 0) {
+ if ((len = bp->b_bcount) == 0) {
goto done;
}
/*
+ * Check the adapter can do it
+ */
+ scsi_minphys(bp,&st_switch);
+ /*
* Odd sized request on fixed drives are verboten
*/
if (st->flags & ST_FIXEDBLOCKS) {
@@ -927,12 +932,21 @@ st_strategy(struct buf *bp, struct scsi_link *sc_link)
}
/*
* as are out-of-range requests on variable drives.
+ * (or if we got chopped by minphys)
*/
- else if (bp->b_bcount < st->blkmin || bp->b_bcount > st->blkmax) {
- printf("st%d: bad request, must be between %ld and %ld\n",
- unit, st->blkmin, st->blkmax);
- bp->b_error = EIO;
- goto bad;
+ else {
+ if ((bp->b_bcount < st->blkmin || bp->b_bcount > st->blkmax)) {
+ printf("st%d: bad request, must be between %ld and %ld\n",
+ unit, st->blkmin, st->blkmax);
+ bp->b_error = EIO;
+ goto bad;
+ }
+ if (len != bp->b_bcount) {
+ printf("st%d: bad request, must be less than %ld bytes\n",
+ unit, bp->b_bcount + 1
+ bp->b_error = EIO;
+ goto bad;
+ }
}
opri = splbio();
OpenPOWER on IntegriCloud