From 274ede62a872185bab3ceba8acbf19b91ea4e395 Mon Sep 17 00:00:00 2001 From: "Simon L. B. Nielsen" Date: Sun, 18 Jun 2006 22:01:15 +0000 Subject: [PATCH] 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 --- sys/geom/geom_dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index bbb4b3afe035..7b15559680fd 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -353,6 +353,7 @@ g_dev_strategy(struct bio *bp) if ((bp->bio_offset % cp->provider->sectorsize) != 0 || (bp->bio_bcount % cp->provider->sectorsize) != 0) { + bp->bio_resid = bp->bio_bcount; biofinish(bp, NULL, EINVAL); return; }