Bug 136866

Summary: IDE crashed on hdparm -U
Product: [openSUSE] SUSE Linux 10.1 Reporter: Hannes Reinecke <hare>
Component: KernelAssignee: Jens Axboe <axboe>
Status: RESOLVED WONTFIX QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: behlert, vojtech
Version: Alpha 3plus   
Target Milestone: ---   
Hardware: x86   
OS: Other   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: hotswap.oops
ide-cd.diff

Description Hannes Reinecke 2005-12-05 08:55:16 UTC
To support device hotswap we have to execute 'hdparm -U' to remove the drive from the IDE layer. This results in a kernel oops.
Comment 1 Hannes Reinecke 2005-12-05 08:55:55 UTC
Created attachment 59784 [details]
hotswap.oops

Dmesg output with the oops.
Comment 4 Hannes Reinecke 2005-12-05 09:10:01 UTC
Created attachment 59786 [details]
ide-cd.diff

Patch to fix ide-cd.
Comment 5 Hannes Reinecke 2005-12-05 09:16:30 UTC
The above patch tries to fix this.

The first hunk shouldn't be needed (strictly speaking), as it's just a quick exit in case the door status hasn't changed. 

The second and the third hunk are an obvious fix. One should not call any function from a _remove call which tries to access the device and expect this call to succeed. The device is already halfway gone at this point.

The fourth hunk is the most interesting. Someone is removing the driver_data pointer from underneath us. As this pointer is basically the backlink to the encompassing data structure we don't actually have any information lost and can just restore the pointer.
Main point still stands: Who is removing the pointer? I couldn't see anything obvious; the most obvious candidate (ie ide_cd_release) is called during the remove calls only and is out of the race.

Greg, any ideas?
Comment 6 Jens Axboe 2005-12-12 15:45:51 UTC
Hannes, I think that looks pretty hackish :-)

Hotplug isn't really supported in the pata ide driver (not sata, for that matter). It likely needs a lot more fixing to work reliably.
Comment 10 Hannes Reinecke 2005-12-14 15:14:48 UTC
Yes, that is pretty hackish. It just corrects the most glaring errors within the IDE core. Unless someone really digs into it and actually rewrites the IDE driver to be driver core conformant proper hotplug support is not going to happen.