[openib-general] slab error in kmem_cache_destroy(): cache `ib_mad': Can't free all objects
Hal Rosenstock
halr at voltaire.com
Mon May 2 14:15:39 PDT 2005
On Mon, 2005-05-02 at 16:45, Hal Rosenstock wrote:
> I don't see a MAD leak but perhaps see a couple of other possible memory
> leaks on shutdown.
>
> It looks to me like agent.c has the following issue on shutdown:
> ib_agent_port_close removes the port from the agent port list before
> deregistering its MAD agents. This causes any send completions to fail
> the lookup and hence a number of resources are not returned in this
> scenario. In that case, I would expect the following to be seend in
> dmesg: "agent_send_handler: no matching MAD agent". Since this message
> is not seen, this is not the scenario that is occurring but I will make
> up a patch for this and send it to the list.
Here's the patch for this:
Index: agent.c
===================================================================
-- agent.c (revision 2247)
+++ agent.c (working copy)
@@ -342,16 +342,19 @@
spin_lock_irqsave(&ib_agent_port_list_lock, flags);
port_priv = __ib_get_agent_port(device, port_num, NULL);
+ spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
if (port_priv == NULL) {
- spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
printk(KERN_ERR SPFX "Port %d not found\n", port_num);
return -ENODEV;
}
+
+ ib_unregister_mad_agent(port_priv->perf_mgmt_agent);
+ ib_unregister_mad_agent(port_priv->smp_agent);
+
+ spin_lock_irqsave(&ib_agent_port_list_lock, flags);
list_del(&port_priv->port_list);
spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
- ib_unregister_mad_agent(port_priv->perf_mgmt_agent);
- ib_unregister_mad_agent(port_priv->smp_agent);
kfree(port_priv);
return 0;
More information about the general
mailing list