qla2300 & mptscsih refcount, or lack thereof
Folks,
I've run into an interesting problem. The qla2300 and
mptspi drivers don't get refcounted for active users, but they are absolutely required. Thus, you can do, eg, "rmmod qla2300" with mounted filesystems, and your system happily removes all child devices. Hello, EIO!
Now, I know we're well into "Doctor, it hurts when I do this,"
territory here. But we generally try not to allow this sort of mistake. You can't remove a network card while the interface is up, you can't remove sd_mod while a disk is in use, etc.
Has this been seen before? Is there any plan to make qla2300
and mptspi respect the use count of the objects they present to the system? Thoughts?
Joel
Signature · 9 lines
Life's Little Instruction Book #222 "Think twice before burdening a friend with a secret." Joel Becker Principal Software Developer Oracle E-mail: [email protected] Phone: (650) 506-8127
Quoted 5 lines · Joel Becker
Folks,
I've run into an interesting problem. The qla2300 and
mptspi drivers don't get refcounted for active users, but they are absolutely required. Thus, you can do, eg, "rmmod qla2300" with mounted filesystems, and your system happily removes all child devices.
Quoted 8 lines
Hello, EIO!
Now, I know we're well into "Doctor, it hurts when I do this,"
territory here. But we generally try not to allow this sort of mistake. You can't remove a network card while the interface is up, you can't removesd_modwhile a disk is in use, etc.
Has this been seen before? Is there any plan to make qla2300
and mptspi respect the use count of the objects they present to the system? Thoughts?
The qla driver increments the underlying qla2xxx module ref count rather than the qla2n00 module. Look at qla_os.c setting of .module, and scsi_device_get() code, and the complete lsmod output. qla_os.c code is included in qla2xxx, so its THIS_MODULE references qla2xxx instead of qla2n00.
The code would have to change to set the correct THIS_MODULE for use in scsi_device_get(), the qla2n00 can't just override the template, else you would get bad module ref counts if you had mixed qla hardware in your system.
We probably need to duplicate the .module in struct scsi_host, set it appropriately (by default copy struct scsi_host_template value), and then use it in scsi_device_get().
I haven't looked at mptspi drivers.
-- Patrick Mansfield
Quoted 21 lines · Patrick Mansfield
Quoted 5 lines · Joel Becker
Folks,
I've run into an interesting problem. The qla2300 and
mptspi drivers don't get refcounted for active users, but they are absolutely required. Thus, you can do, eg, "rmmod qla2300" with mounted filesystems, and your system happily removes all child devices.Quoted 8 lines
Hello, EIO!
Now, I know we're well into "Doctor, it hurts when I do this,"
territory here. But we generally try not to allow this sort of mistake. You can't remove a network card while the interface is up, you can't removesd_modwhile a disk is in use, etc.
Has this been seen before? Is there any plan to make qla2300
and mptspi respect the use count of the objects they present to the system? Thoughts?The qla driver increments the underlying qla2xxx module ref count rather than the qla2n00 module. Look at
qla_os.csetting of .module, andscsi_device_get()code, and the complete lsmod output.qla_os.ccode is included in qla2xxx, so itsTHIS_MODULEreferences qla2xxx instead of qla2n00.
Quoted 8 lines
The code would have to change to set the correct
THIS_MODULEfor use inscsi_device_get(), the qla2n00 can't just override the template, else you would get bad module ref counts if you had mixed qla hardware in your system.We probably need to duplicate the .module in struct
scsi_host, set it appropriately (by default copy structscsi_host_templatevalue), and then use it inscsi_device_get().
I had previously posted a patch:
[PATCH 10/12] qla2xxx: Correct fw-loader module-use referencing.
http://marc.theaimsgroup.com/?l=linux-scsi&m=112924546828936&w=2
which corrected this behaviour. But considering the direction the qla2xxx driver was heading with respect to 'firmware-loader modules', the patch was back-burnered.
scsi-misc-2.6.git already has a set of patches which moves the qla2xxx driver to a single-module driver where firmware is loaded via the request-firmware APIs.
--
av