public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* a strange lock
@ 2020-02-03 12:31 Frank Huang
  2020-02-03 13:30 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Frank Huang @ 2020-02-03 12:31 UTC (permalink / raw)
  To: linux-rdma

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/infiniband/core/cma.c#n1832

/*
* Wait for any active callback to finish.  New callbacks will find
* the id_priv state set to destroying and abort.
*/
mutex_lock(&id_priv->handler_mutex);
mutex_unlock(&id_priv->handler_mutex);

It does nothing between the lock, what 's the meaning of it?

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

* Re: a strange lock
  2020-02-03 12:31 a strange lock Frank Huang
@ 2020-02-03 13:30 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2020-02-03 13:30 UTC (permalink / raw)
  To: Frank Huang; +Cc: linux-rdma

On Mon, Feb 03, 2020 at 08:31:10PM +0800, Frank Huang wrote:
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/infiniband/core/cma.c#n1832
>
> /*
> * Wait for any active callback to finish.  New callbacks will find
> * the id_priv state set to destroying and abort.
> */
> mutex_lock(&id_priv->handler_mutex);
> mutex_unlock(&id_priv->handler_mutex);
>
> It does nothing between the lock, what 's the meaning of it?

It is a way to implement wait_for_completion paradigm, by ensuring
that all cm_id works or will see RDMA_CM_DESTROYING state (they need
to take handler_mutex, before every call to cma_exch), or will
complete their execution and release handler_mutex.

Thanks

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

end of thread, other threads:[~2020-02-03 13:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-03 12:31 a strange lock Frank Huang
2020-02-03 13:30 ` Leon Romanovsky

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