Some read-errors on floppys not reported on 2.4.22

From: Richard B. Johnson
Date: Fri Aug 29 2003 - 11:18:00 EST


Given the following program:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
int main()
{
int fd;
char buf[0x1000];
if((fd = open("/dev/fd0", O_RDONLY)) < 0)
{
perror("open");
exit(EXIT_FAILURE);
}
while(read(fd, buf, sizeof(buf)) > 0)
;
perror("read");
close(fd);
return 0;
}

This program will return:

Script started on Fri Aug 29 12:05:32 2003
# ./xxx
read: Success
# exit
exit

Script done on Fri Aug 29 12:05:51 2003

Success, even where there are lots of CRC errors that
prematurely terminate the read:

end_request: I/O error, dev 02:00 (floppy), sector 101
floppy0: data CRC error: track 2, head 1, sector 12, size 2
floppy0: data CRC error: track 2, head 1, sector 12, size 2
end_request: I/O error, dev 02:00 (floppy), sector 101
floppy0: data CRC error: track 3, head 1, sector 3, size 2
floppy0: data CRC error: track 3, head 1, sector 3, size 2
end_request: I/O error, dev 02:00 (floppy), sector 128
floppy0: data CRC error: track 2, head 1, sector 12, size 2
floppy0: data CRC error: track 2, head 1, sector 12, size 2
end_request: I/O error, dev 02:00 (floppy), sector 101


This is NotGood(tm); A program may think it got all the
data, from a floppy when, in fact it wasn't able to read
more than a few sectors.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.22 on an i686 machine (794.73 BogoMips).
Note 96.31% of all statistics are fiction.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/