In g_dev_strategy(), when failing an IO request with EINVAL due to

offset or request size which is not a multiple of the sector size, make
sure that the bio is set to indicate that no data has actually been
transferred.

The result of this is that the file offset is no longer incremented for
these requests.  The fact that the file offset was incremented broke
fdisk(8)'s probing of sector size for non-512 byte sector sizes.

Reviewed by:	phk, cperciva
Submitted by:	mdodd
MFC after:	2 weeks
This commit is contained in:
Simon L. B. Nielsen 2006-06-18 22:01:15 +00:00
parent b06185fd6d
commit 274ede62a8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159756

View File

@ -353,6 +353,7 @@ g_dev_strategy(struct bio *bp)
if ((bp->bio_offset % cp->provider->sectorsize) != 0 || if ((bp->bio_offset % cp->provider->sectorsize) != 0 ||
(bp->bio_bcount % cp->provider->sectorsize) != 0) { (bp->bio_bcount % cp->provider->sectorsize) != 0) {
bp->bio_resid = bp->bio_bcount;
biofinish(bp, NULL, EINVAL); biofinish(bp, NULL, EINVAL);
return; return;
} }