ATAPI-CD corruption since GEOMification (& possible fix)

Peter Edwards pmedwards at eircom.net
Sat Nov 8 13:31:40 PST 2003


With a -current built after atapi-cd was changed over to GEOM, reads
from a filesystem mounted on a CD device are being corrupted, with
junk being inserted into the file from offset 63489 onwards.

I had a quick look around atapi-cd.c, and I think I spotted the
problem: applying this patch certainly stopped the corruption
I was seeing. Anyone else seeing this? Can someone verify that
this is indeed the correct fix?

My CD device probes as:
acd1: CDRW <CW088D ATAPI CD-R/RW> at ata1-slave PIO4
If its of any interest.

Index: atapi-cd.c
===================================================================
RCS file: /usr/cvs/FreeBSD-CVS/src/sys/dev/ata/atapi-cd.c,v
retrieving revision 1.152
diff -u -r1.152 atapi-cd.c
--- atapi-cd.c  7 Nov 2003 08:31:09 -0000       1.152
+++ atapi-cd.c  8 Nov 2003 21:06:15 -0000
@@ -1018,7 +1018,7 @@
        u_int pos, size = cdp->iomax - cdp->iomax % bp->bio_to->sectorsize;
        struct bio *bp2;
 
-       for (pos = 0; pos < bp->bio_length; pos += bp->bio_length) {
+       for (pos = 0; pos < bp->bio_length; pos += size) {
            if (!(bp2 = g_clone_bio(bp))) {
                bp->bio_error = ENOMEM;
                break;

-- 
Peter Edwards.




More information about the freebsd-current mailing list