public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* qla2300 & mptscsih refcount, or lack thereof
@ 2005-12-30 23:50 Joel Becker
  2006-01-03 19:17 ` Patrick Mansfield
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Becker @ 2005-12-30 23:50 UTC (permalink / raw)
  To: andrew.vasquez, Eric.Moore, linux-scsi, James Bottomley

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

-- 

Life's Little Instruction Book #222

	"Think twice before burdening a friend with a secret."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: qla2300 & mptscsih refcount, or lack thereof
  2005-12-30 23:50 qla2300 & mptscsih refcount, or lack thereof Joel Becker
@ 2006-01-03 19:17 ` Patrick Mansfield
  2006-01-03 19:28   ` Andrew Vasquez
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick Mansfield @ 2006-01-03 19:17 UTC (permalink / raw)
  To: andrew.vasquez, Eric.Moore, linux-scsi, James Bottomley

On Fri, Dec 30, 2005 at 03:50:30PM -0800, Joel Becker wrote:
> 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?

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: qla2300 & mptscsih refcount, or lack thereof
  2006-01-03 19:17 ` Patrick Mansfield
@ 2006-01-03 19:28   ` Andrew Vasquez
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Vasquez @ 2006-01-03 19:28 UTC (permalink / raw)
  To: Patrick Mansfield; +Cc: Eric.Moore, linux-scsi, Joel Becker, James Bottomley

On Tue, 03 Jan 2006, Patrick Mansfield wrote:

> On Fri, Dec 30, 2005 at 03:50:30PM -0800, Joel Becker wrote:
> > 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?
> 
> 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 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: qla2300 & mptscsih refcount, or lack thereof
@ 2006-01-03 22:03 Moore, Eric
  0 siblings, 0 replies; 4+ messages in thread
From: Moore, Eric @ 2006-01-03 22:03 UTC (permalink / raw)
  To: Patrick Mansfield, andrew.vasquez, linux-scsi, James Bottomley

On Tuesday, January 03, 2006 12:18 PM, Patrick Mansfield wrote: 

> snip....

> 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
> 

There is a patch I posted about a month ago having .module=THIS_MODULE,
in the mptspi.c source.   James Bottomley posted earlier today in
my "Eric Moore" section regarding this.  I believe that is all that is
required
for reference counting, right?  If not, pls let me know.

JB - URL:
http://marc.theaimsgroup.com/?l=linux-scsi&m=113630625920693&w=2

Eric Moore

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-01-03 22:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-30 23:50 qla2300 & mptscsih refcount, or lack thereof Joel Becker
2006-01-03 19:17 ` Patrick Mansfield
2006-01-03 19:28   ` Andrew Vasquez
  -- strict thread matches above, loose matches on Subject: below --
2006-01-03 22:03 Moore, Eric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox