diff options
| author | Peter Wemm <peter@FreeBSD.org> | 1999-12-28 07:32:34 +0000 |
|---|---|---|
| committer | Peter Wemm <peter@FreeBSD.org> | 1999-12-28 07:32:34 +0000 |
| commit | 358746d7a8622319db9248d360dd0295efb7d92e (patch) | |
| tree | 5ed1b1f8fddf0d285517cbb7fb62880be3a0137b | |
| parent | ea3aecf5b4965e23923f1b7063e40bf363635c62 (diff) | |
Notes
| -rw-r--r-- | sys/dev/vn/vn.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c index 0d8e9e339efd..49fa104a0918 100644 --- a/sys/dev/vn/vn.c +++ b/sys/dev/vn/vn.c @@ -311,6 +311,18 @@ vnstrategy(struct buf *bp) int pbn; /* in sc_secsize chunks */ long sz; /* in sc_secsize chunks */ + /* + * Check for required alignment. Transfers must be a valid + * multiple of the sector size. + */ + if (bp->b_bcount % vn->sc_secsize != 0 || + bp->b_blkno % (vn->sc_secsize / DEV_BSIZE) != 0) { + bp->b_error = EINVAL; + bp->b_flags |= B_ERROR | B_INVAL; + biodone(bp); + return; + } + pbn = bp->b_blkno / (vn->sc_secsize / DEV_BSIZE); sz = howmany(bp->b_bcount, vn->sc_secsize); @@ -390,7 +402,7 @@ vnstrategy(struct buf *bp) * Note: if we pre-reserved swap, B_FREEBUF is disabled */ KASSERT((bp->b_bufsize & (vn->sc_secsize - 1)) == 0, - ("vnstrategy: buffer %p to small for physio", bp)); + ("vnstrategy: buffer %p too small for physio", bp)); if ((bp->b_flags & B_FREEBUF) && TESTOPT(vn, VN_RESERVE)) { biodone(bp); |
