mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 12:28:58 +00:00
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)
This commit is contained in:
parent
3948edc24c
commit
827d45ab08
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11439
@ -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,
|
||||
@ -373,6 +373,11 @@ sd_strategy(struct buf *bp, struct scsi_link *sc_link)
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/*
|
||||
* check it's not too big a transfer for our adapter
|
||||
*/
|
||||
scsi_minphys(bp,&sd_switch);
|
||||
|
||||
/*
|
||||
* Odd number of bytes
|
||||
*/
|
||||
|
@ -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,9 +912,13 @@ 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
|
||||
*/
|
||||
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user