[openib-general] [PATCH] Missing check for atomic_dec in ib_post_send_mad

Sean Hefty mshefty at ichips.intel.com
Tue Nov 2 09:52:39 PST 2004


On Mon, 1 Nov 2004 17:50:26 -0800 (PST)
Krishna Kumar <krkumar at us.ibm.com> wrote:

> 	spin_lock_irqsave(&port_priv->reg_lock, flags);
>         /* Determine corresponding MAD agent for incoming receive MAD
>         */ solicited = solicited_mad(recv->header.recv_buf.mad);
>         mad_agent = find_mad_agent(port_priv,
>         recv->header.recv_buf.mad,
>                                    solicited);
>         if (!mad_agent) {
>                 spin_unlock_irqrestore(&port_priv->reg_lock, flags);
>                 printk(KERN_NOTICE PFX "No matching mad agent found
>                 for "
>                        "received MAD on port %d\n",
>                        port_priv->port_num);
>         } else {
>                 atomic_inc(&mad_agent->refcount);
>                 spin_unlock_irqrestore(&port_priv->reg_lock, flags);
>                 ib_mad_complete_recv(mad_agent, recv, solicited);

Related to this, the call to solicited_mad() doesn't need to be made
while holding the lock.  Moving this outside, we can push the locking
inside find_mad_agent as well, if it makes more sense to do so.

- Sean



More information about the general mailing list