Linux: 2.5 Floppy Driver Fixed

Submitted by Jeremy
on September 3, 2002 - 10:41pm

With the recent release of 2.5.33, Linus Torvalds commented:

"There's a fair amount of stuff in here again, but I'd personally like to have people who actually use that d*ng floppy driver please test it out. I finally broke down and tried to fix it, since it's been broken in 2.5.x for longer than most people care to remember. I don't even have floppies to test with, I just verified that I could read two old backup disks, and one seemed fine, and the other read 90% of the thing, which was a lot more than I expected since they are both at least five years old. I've never had good luck with those unreliable 3.5" things, I'd rather have as little to do with them as possible."

Today Linus posted a small patch against 2.5.33 fixing a problem where "any partial request completion would be totally messed up by the BIO layer". Jens Axboe acknowledged that that patch was correct, "the most embarassing thing is that Bart and I have both found this independently months ago but it seems it got lost at my end (or your end, but lets not point fingers :-) :-(" The bug triggered corruption with the floppy driver, and possibly other block device drivers generating partial requests.

Linus then provided a second patch that cleans up end_request() in the floppy driver and seems to fully solve the floppy data corruption issues. Mikael Pettersson reported, "Success! With this patch and your previous two the floppy driver passes all tests I've thrown at it, including raw data access, VFS access with ext2, installing lilo, fsck, and booting the result." That said, with the upcoming release of 2.5.34 the development kernel should again have a working floppy driver that doesn't cause data corruption.


From: Linus Torvalds
To: Kernel Mailing List
Subject: Linux v2.5.33
Date: Sat, 31 Aug 2002 15:22:31 -0700 (PDT)

There's a fair amount of stuff in here again, but I'd personally like to
have people who actually use that d*ng floppy driver please test it out. I
finally broke down and tried to fix it, since it's been broken in 2.5.x
for longer than most people care to remember.

I don't even have floppies to test with, I just verified that I could read
two old backup disks, and one seemed fine, and the other read 90% of the
thing, which was a lot more than I expected since they are both at least
five years old. I've never had good luck with those unreliable 3.5"
things, I'd rather have as little to do with them as possible.

Anyway, apart from floppies, this has the IDE organizational cleanups by
Al, another merge with Andrew, and some new networking stuff (TCP
segmentation offload onto network cards, and initial cut of SCTP support).

And NTFS, JFS, and of course USB updates. Oh, and some of the keyboard
input stuff should fix some random breakage in the input switchover.

Linus


From: Linus Torvalds
Subject: One more bio for for floppy users in 2.5.33..
Date: Tue, 3 Sep 2002 11:00:39 -0700 (PDT)

Ok,
I found another major bio-related bug that definitely explains why the
floppy driver generated corruption - any partial request completion would
be totally messed up by the BIO layer (not the floppy driver).

Any other block device driver that did partial request completion might
also be impacted.

I'm still looking at the floppy driver itself - some of the request
completion code is so messed up as to be unreadable, and some of that may
actually be due to trying to work around the bio problem (unsuccessfully,
I may add). So this may not actually fix things for you yet, simply
because the floppy driver itself still does some strange things.

Jens, oops. We should not update the counts by how much was left
uncompleted, but by how much we successfully completed!

Linus

[patch]



From: Jens Axboe
Subject: Re: One more bio for for floppy users in 2.5.33..
Date: Tue, 3 Sep 2002 20:02:03 +0200

Yeah oops, the most embarassing thing is that Bart and I have both found
this but independently months ago but it seems it got lost at my end (or
your end, but lets not point fingers :-) :-(

Patch is ofcourse correct. I'm not sure other drivers have been hit (of
the used ones), since they would have to use old style completions and
do less than current_nr_sectors in one-go.

--
Jens Axboe



From: Mikael Pettersson
Subject: Re: One more bio for for floppy users in 2.5.33..
Date: Tue, 3 Sep 2002 22:57:32 +0200

Confirmed. 2.5.33 + your two patches still corrupts data on a simple
dd to then from /dev/fd0 test.

/Mikael



From: Linus Torvalds
To: Mikael Pettersson
cc: Kernel Mailing List
Subject: Re: One more bio for for floppy users in 2.5.33..
Date: Tue, 3 Sep 2002 14:52:08 -0700 (PDT)
Sender: linux-kernel-owner@vger.kernel.org

On Tue, 3 Sep 2002, Mikael Pettersson wrote:
>
> Confirmed. 2.5.33 + your two patches still corrupts data on a simple
> dd to then from /dev/fd0 test.

Ok, if you don't have BK, then here's the floppy driver end_request()
cleanup as a plain patch.

This passes dd tests for me, but they were by no means very exhaustive.

Linus

[patch]



From: Mikael Pettersson
Subject: Re: One more bio for for floppy users in 2.5.33..
Date: Wed, 4 Sep 2002 00:33:12 +0200

Success! With this patch and your previous two the floppy driver
passes all tests I've thrown at it, including raw data access,
VFS access with ext2, installing lilo, fsck, and booting the result.

Thanks.

/Mikael


Related Links:

It's in 2.5-BK

nimrod
on
September 4, 2002 - 3:14pm

It's worth noting that this fix is in 2.5-BK, so 2.5.34 will have it. here's the BK changset.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.