Add disk hotswap support to libata
cover Add disk hotswap support to libata
Hey all, introductory blurb here.
This sequence of patches will add a framework to libata to allow for hot-swapping disks in and out.
There are three patches:
01-promise_sataII150_support
02-libata_hotswap_infrastructure
03-promise_hotswap_support
The rationale for each will be described in following emails.
I encourage anyone with design ideas to come forward and contribute, and anyone who can see concurrency problems (I will describe what I see as issues along with the second patch) to suggest fixes.
Thus far, I've tested this HEAVILY with a 2.6.11.12 kernel + 2.6.11-libata-dev1.patch. I have found no issues outstanding on that kernel. All testing was done with Promise SATA150 and SATAII150 Tx4/Tx2
Plus controllers and a huge variety of Western Digital and Seagate disks.
I have ported my patches to 2.6.13-rc3 and 2.6.13-rc3-mm1, and have tested on the latter as well; they work identically to the 2.6.11 tests except for a breakage in the SCSI layer [1].
The patches I will attach apply to the latter (2.6.13-rc3-mm1) tree, since I expect that by the time people start looking at them seriously, the existing libata patches in that tree will have become part of mainline. If this is NOT the right thing to do, please tell me, and I'll submit patches for the requested kernel version.
Enjoy!
Luke Kosewski
Human Cannonball
Net Integration Technologies
[1] The SCSI error on 2.6.13-rc3-mm1 that I found:
'echo "scsi add-single-device a b c d" > /proc/scsi/scsi' //works, or no-op if the sd corresponding to that device is there already 'echo "scsi remove-single-device a b c d" > /proc/scsi/scsi' //works
'echo "scsi add-single-device a b c d" > /proc/scsi/scsi' //works
'echo "scsi remove-single-device a b c d" > /proc/scsi/scsi' //FAILS
As such, since the same underlying functions are called by hotplugging, you will only be able to remove a disk from a device once before it fails, until this error is fixed. I'll look into it as well.
Lukasz Kosewski wrote:
[]
Quoted 5 lines
[1] The SCSI error on 2.6.13-rc3-mm1 that I found:
'echo "scsi add-single-device a b c d" >/proc/scsi/scsi' //works, or no-op if the sd corresponding to that device is there already 'echo "scsi remove-single-device a b c d" >/proc/scsi/scsi' //works
'echo "scsi add-single-device a b c d" >/proc/scsi/scsi' //works
'echo "scsi remove-single-device a b c d" >/proc/scsi/scsi' //FAILS
echo -n 1 > /sys/.../hostA/targetA:B:C/A:B:C:D/delete
still works. I think.
And (again, I think) this same problem exists with 2.6.11 as well. At least, I wasn't able to remove-single-device even once (I discovered this mechanism only recently, haven't tried it with other kernels).
Quoted 1 line
As such, since the same underlying functions are called by hotplugging, you will only be able to remove a disk from a device once before it fails, until this error is fixed. I'll look into it as well.
/mjt
Quoted 5 lines · Michael Tokarev
echo -n 1 > /sys/.../hostA/targetA:B:C/A:B:C:D/delete
still works. I think.
And (again, I think) this same problem exists with 2.6.11 as well. At least, I wasn't able to remove-single-device even once (I discovered this mechanism only recently, haven't tried it with other kernels).
You're both correct and incorrect based on my testing; in 2.6.11.12, I have no problems.
However, in 2.6.13-rc1-mm1, you're right that echoing 1 into the delete node does remove the device.
It seems that there is some issue with the 'scsi_device_lookup' function then?
I'd have to debug further.
Luke Kosewski
Human Cannonball
Net Integration Technologies
Quoted 8 lines · Lukasz Kosewski
Hey all, introductory blurb here.
This sequence of patches will add a framework to libata to allow for hot-swapping disks in and out.
There are three patches:
01-promise_sataII150_support
02-libata_hotswap_infrastructure
03-promise_hotswap_support
Pretty cool stuff!
As soon as I finish SATA ATAPI (this week[end]), I'll take a look at this. A quick review of the patches didn't turn up anything terribly objectionable, though :)
Jeff
P.S. You might want to CC linux-ide as well, on libata patches.
Quoted 6 lines · Jeff Garzik
Pretty cool stuff!
As soon as I finish SATA ATAPI (this week[end]), I'll take a look at this. A quick review of the patches didn't turn up anything terribly objectionable, though :)
Excellent! Thanks for the quick turnaround!
Quoted 1 line
P.S. You might want to CC linux-ide as well, on libata patches.
I've CCed the original patches to Linux-ide for comments. Also, I've re-sent patch 3 with a minor fix to boolean logic with bits.
Enjoy!
Luke Kosewski
Human Cannonball
Net Integration Technologies
Quoted 4 lines · Jeff Garzik
As soon as I finish SATA ATAPI (this week[end]), I'll take a look at this. A quick review of the patches didn't turn up anything terribly objectionable, though :)
I would like to offer to test when you are ready. Some older and new SATAPI drives, various chipsets (ICH{5,6}, TX4 on the way). And a SATA analyzer for anything really odd.
++doug
Quoted 7 lines · Doug Maxey
Quoted 2 lines · Jeff Garzik
As soon as I finish SATA ATAPI (this week[end]), I'll take a look at this. A quick review of the patches didn't turn up anything terribly objectionable, though :)
I would like to offer to test when you are ready. Some older and new SATAPI drives, various chipsets (ICH{5,6}, TX4 on the way). And a SATA analyzer for anything really odd.
Great!
It'll be posted here on linux-ide, so just keep an eye out.
Analysis of any portion of libata, with a SATA analyzer, would be much appreciated.
Jeff