[SCSI] fcoe: Fix module reference count for vports
authorRobert Love <robert.w.love@intel.com>
Sat, 29 Jan 2011 00:03:47 +0000 (16:03 -0800)
committerJames Bottomley <James.Bottomley@suse.de>
Sat, 12 Feb 2011 16:59:30 +0000 (10:59 -0600)
commit7287fb9114096503eddfffb7b2ed691c809a6106
tree416689671a8c97792ef481f29b0e2031bbab789d
parent6da92d3463cd60f5b804475f70f659dc07331929
[SCSI] fcoe: Fix module reference count for vports

vports are not grabbing module references but are
releasing them. This causes the module reference count
to decrement too many times and it wraps around past 0.

The solution is to do a module_put() in
fcoe_interface_release() so that the reference is only
released when the fcoe_interface is released. There is a
one-to-one relationship between the N_Port and the
fcoe_interface, so the module reference will only be
dropped when the N_Port is destroyed

To create symetry in the code this patch moves the
try_module_get() call into fcoe_interface_create(). This
means that only the N_Port will grab a reference to the
module when its corresponding fcoe_interface is created.

This patch also makes it so that the fcoe_interface_create()
routine encodes any error codes in the fcoe_interface
pointer returned. This way its caller, fcoe_create(), can
return an accurate error code.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/fcoe/fcoe.c
This page took 0.024379 seconds and 5 git commands to generate.