public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Frank Huang <tigerinxm@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: a strange lock
Date: Mon, 3 Feb 2020 15:30:50 +0200	[thread overview]
Message-ID: <20200203133050.GP414821@unreal> (raw)
In-Reply-To: <CAKC_zSu1SQgNT5Yyg49qe+r+hux-3oCqzZPvH0b7pjaPz2x2Rw@mail.gmail.com>

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

      reply	other threads:[~2020-02-03 13:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03 12:31 a strange lock Frank Huang
2020-02-03 13:30 ` Leon Romanovsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200203133050.GP414821@unreal \
    --to=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=tigerinxm@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox