On Mon, 2010-10-04 at 17:36 -0700, Robert Love wrote:
> vports are grabbing module references but not releasing
> them.
>
> Do a module_put() in fcoe_interface_release() so that
> vports release module references. Also, move the
> try_module_get() into fcoe_interface_create() to
> create symetry in the calls.
>
This is incorrect. vports were not getting references, but were
releasing them. Like I said, this patch is incomplete... ;)
> This patch is only for discussion purposes and has not
> been fully tested. There may be another issue with
> reference counting without NPIV. I was seeing refereces
> grabbed by scsi_device_get() that were not being
> released after destroying the fcoe interface. However,
> my kernel tree is fairly old so more testing is needed
> before drawing any conclusions.
> ---
> drivers/scsi/fcoe/fcoe.c | 44 ++++++++++++++++++++++----------------------
> 1 files changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
> index d23a538..a1d4bdc 100644
> --- a/drivers/scsi/fcoe/fcoe.c
> +++ b/drivers/scsi/fcoe/fcoe.c
> @@ -356,10 +356,25 @@ static struct fcoe_interface
> *fcoe_interface_create(struct net_device *netdev,
> struct fcoe_interface *fcoe;
> int err;
>
> +#ifdef CONFIG_FCOE_MODULE
> + /*
> + * Make sure the module has been initialized, and is not about to be
> + * removed. Module paramter sysfs files are writable before the
> + * module_init function is called and after module_exit.
> + */
> + if (THIS_MODULE->state != MODULE_STATE_LIVE)
> + return NULL;
> +#endif
> +
> + if (!try_module_get(THIS_MODULE)) {
> + FCOE_NETDEV_DBG(netdev, "Could get reference to module\n");
> + return NULL;
> + }
> +
> fcoe = kzalloc(sizeof(*fcoe), GFP_KERNEL);
> if (!fcoe) {
> FCOE_NETDEV_DBG(netdev, "Could not allocate fcoe structure\n");
> - return NULL;
> + goto out_nomod;
> }
>
> dev_hold(netdev);
> @@ -378,10 +393,14 @@ static struct fcoe_interface
> *fcoe_interface_create(struct net_device *netdev,
> fcoe_ctlr_destroy(&fcoe->ctlr);
> kfree(fcoe);
> dev_put(netdev);
> - return NULL;
> + goto out_nomod;
> }
>
> return fcoe;
> +
> +out_nomod:
> + module_put(THIS_MODULE);
> + return NULL;
> }
>
> /**
> @@ -442,6 +461,7 @@ static void fcoe_interface_release(struct kref *kref)
> fcoe_ctlr_destroy(&fcoe->ctlr);
> kfree(fcoe);
> dev_put(netdev);
> + module_put(THIS_MODULE);
> }
>
> /**
> @@ -884,7 +904,6 @@ static void fcoe_if_destroy(struct fc_lport *lport)
>
> /* Release the Scsi_Host */
> scsi_host_put(lport->host);
> - module_put(THIS_MODULE);
> }
>
> /**
> @@ -2125,23 +2144,6 @@ static int fcoe_create(const char *buffer, struct
> kernel_param *kp)
> return restart_syscall();
> }
>
> -#ifdef CONFIG_FCOE_MODULE
> - /*
> - * Make sure the module has been initialized, and is not about to be
> - * removed. Module paramter sysfs files are writable before the
> - * module_init function is called and after module_exit.
> - */
> - if (THIS_MODULE->state != MODULE_STATE_LIVE) {
> - rc = -ENODEV;
> - goto out_nomod;
> - }
> -#endif
> -
> - if (!try_module_get(THIS_MODULE)) {
> - rc = -EINVAL;
> - goto out_nomod;
> - }
> -
> netdev = fcoe_if_to_netdev(buffer);
> if (!netdev) {
> rc = -ENODEV;
> @@ -2196,8 +2198,6 @@ out_free:
> out_putdev:
> dev_put(netdev);
> out_nodev:
> - module_put(THIS_MODULE);
> -out_nomod:
> rtnl_unlock();
> mutex_unlock(&fcoe_config_mutex);
> return rc;
>
> _______________________________________________
> devel mailing list
> [email protected]
> http://www.open-fcoe.org/mailman/listinfo/devel
_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel