CEPH filesystem development
 help / color / mirror / Atom feed
From: Alex Elder <elder@inktank.com>
To: Sage Weil <sage@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH 6/8] libceph: avoid dropping con mutex before fault
Date: Mon, 30 Jul 2012 19:12:16 -0500	[thread overview]
Message-ID: <501722E0.1080203@inktank.com> (raw)
In-Reply-To: <1343663971-3221-7-git-send-email-sage@inktank.com>

On 07/30/2012 10:59 AM, Sage Weil wrote:
> The ceph_fault() function takes the con mutex, so we should avoid
> dropping it before calling it.  This fixes a potential race with
> another thread calling ceph_con_close(), or _open(), or similar (we
> don't reverify con->state after retaking the lock).
> 
> Add annotation so that lockdep realizes we will drop the mutex before
> returning.
> 
> Signed-off-by: Sage Weil <sage@inktank.com>

Looks good.

Reviewed-by: Alex Elder <elder@inktank.com>

> ---
>  net/ceph/messenger.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
> index feb5a2a..c3b628c 100644
> --- a/net/ceph/messenger.c
> +++ b/net/ceph/messenger.c
> @@ -2336,7 +2336,6 @@ done_unlocked:
>  	return;
>  
>  fault:
> -	mutex_unlock(&con->mutex);
>  	ceph_fault(con);     /* error/fault path */
>  	goto done_unlocked;
>  }
> @@ -2347,9 +2346,8 @@ fault:
>   * exponential backoff
>   */
>  static void ceph_fault(struct ceph_connection *con)
> +	__releases(con->mutex)
>  {
> -	mutex_lock(&con->mutex);
> -
>  	pr_err("%s%lld %s %s\n", ENTITY_NAME(con->peer_name),
>  	       ceph_pr_addr(&con->peer_addr.in_addr), con->error_msg);
>  	dout("fault %p state %lu to peer %s\n",
> 


  reply	other threads:[~2012-07-31  0:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30 15:59 [PATCH 0/8] Last batch of messenger fixes, misc Sage Weil
2012-07-30 15:59 ` [PATCH 1/8] libceph: be less chatty about stray replies Sage Weil
2012-07-30 23:00   ` Alex Elder
2012-07-30 15:59 ` [PATCH 2/8] ceph: update MAINTAINERS file Sage Weil
2012-07-30 23:09   ` Alex Elder
2012-07-30 15:59 ` [PATCH 3/8] libceph: fix handling of immediate socket connect failure Sage Weil
2012-07-31  0:08   ` Alex Elder
2012-07-30 15:59 ` [PATCH 4/8] libceph: revoke mon_client messages on session restart Sage Weil
2012-07-31  0:09   ` Alex Elder
2012-07-30 15:59 ` [PATCH 5/8] libceph: verify state after retaking con lock after dispatch Sage Weil
2012-07-31  0:11   ` Alex Elder
2012-07-30 15:59 ` [PATCH 6/8] libceph: avoid dropping con mutex before fault Sage Weil
2012-07-31  0:12   ` Alex Elder [this message]
2012-07-30 15:59 ` [PATCH 7/8] libceph: change ceph_con_in_msg_alloc convention to be less weird Sage Weil
2012-07-31  0:25   ` Alex Elder
2012-07-31  1:09     ` Sage Weil
2012-07-30 15:59 ` [PATCH 8/8] libceph: recheck con state after allocating incoming message Sage Weil

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=501722E0.1080203@inktank.com \
    --to=elder@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sage@inktank.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