Floppy driver doesn't stop on errors

From: Tomasz Malesinski (tm201069@zodiac.mimuw.edu.pl)
Date: Sun Feb 16 2003 - 07:30:34 EST


I am using 2.5.56 kernel. I haven't tested it with newer versions, but I
haven't found any changes in sources referencing this.

The problem is that when reading a floppy disk with an error the kernel
tries to read the bad sector forever and I found no other way to stop it
than a reboot. It happens because when the floppy driver tries to read a
track with an error it reads all sectors until the error, writes the
number of them to current_count_sectors and passes that number to
end_that_request_first. That's ok, but if the buffer isn't full the next
read starts at the bad sector, no correct sectors are read,
current_count_sectors becomes 0 and the buffer state does not change.

I am not sure what a proper way to fix this is. I changed the beginning of
end_request routine in floppy.c from:

static inline void end_request(struct request *req, int uptodate)
{
        if (end_that_request_first(req, uptodate, current_count_sectors))
                return;

to:

static inline void end_request(struct request *req, int uptodate)
{
        if (end_that_request_first(req, uptodate,
            (!current_count_sectors && !uptodate) ? 1 : current_count_sectors))
                return;

It works for me, but probably it would be better to pass some other value
in case of an error, for example the current bio size in sectors.

Tomasz Malesinski

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



This archive was generated by hypermail 2b29 : Sun Feb 23 2003 - 22:00:14 EST