PATCH, IDE corruption, 2.4.18

Neil Conway
2002-05-03T20:36:25Z

[-- Attachment #1: Type: text/plain, Size: 1762 bytes --]

Well, I say patch, but it's really a band-aid.

[Caveats: before reading further, understand that I'm
not by any means an IDE expert; I have just figured
out how to prevent disk corruption on my PC. I may
have completely missed the point.]

While debugging some "0x58" status errors (which I
believed to have lead to disk corruption) I discovered
that ide_config_drive_speed() uses SELECT_DRIVE
without checking to see if there are disk transfers in
progress (by definition these have to be DMA
transfers). Unless I've misread the ATA specs, this
is a Very Bad Thing.

This means that when modules which call
ide_register_subdriver() are loaded (so far I think
it's just ide-cd and ide-scsi) any disk transfers in
progress on the other half of the cable are stuffed.

This is very easy to reproduce: just do a "dd
if=/dev/hda of=/dev/null" and a few of "rmmod
ide-cd;modprobe ide-cd" (where there must be a CD on
hdb, or hdc and hdd but you get the idea). On my box,
this is about 80% successful each module-load at
causing the "0x58" status error. Repeated usage
trashes inodes (don't know why) and even causes
lockups (don't know why either). This suggests that
the error-recovery doesn't work very well...

Anyway, here's the band aid as promised. A timeout,
or a queued request would be better, but I'm not sure
of how best to do either, so at least now the real
experts can fix it properly...

cheers
Neil
PS: don't know (but doubt it) if this is what caused
the 0x58 problems in 2.2 etc.
PPS: I'm off-list at present, so please CC me if you
want me to notice responses.

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

[-- Attachment #2: ide_patch030502 --]
[-- Type: application/x-unknown, Size: 706 bytes --]