[lkml]   [2003]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectFloppy driver doesn't stop on errors
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))


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))

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
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:33    [W:0.046 / U:7.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site