From: Alex Elder <elder@inktank.com>
To: Sage Weil <sage@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH 5/8] libceph: verify state after retaking con lock after dispatch
Date: Mon, 30 Jul 2012 19:11:07 -0500 [thread overview]
Message-ID: <5017229B.60805@inktank.com> (raw)
In-Reply-To: <1343663971-3221-6-git-send-email-sage@inktank.com>
On 07/30/2012 10:59 AM, Sage Weil wrote:
> We drop the con mutex when delivering a message. When we retake the
> lock, we need to verify we are still in the OPEN state before
> preparing to read the next tag, or else we risk stepping on a
> connection that has been closed.
>
> Signed-off-by: Sage Weil <sage@inktank.com>
Looks good. And good to move the prepare_read_tag() out too.
Reviewed-by: Alex Elder <elder@inktank.com>
> ---
> net/ceph/messenger.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
> index a6a0c7a..feb5a2a 100644
> --- a/net/ceph/messenger.c
> +++ b/net/ceph/messenger.c
> @@ -2003,7 +2003,6 @@ static void process_message(struct ceph_connection *con)
> con->ops->dispatch(con, msg);
>
> mutex_lock(&con->mutex);
> - prepare_read_tag(con);
> }
>
>
> @@ -2213,6 +2212,8 @@ more:
> if (con->in_tag == CEPH_MSGR_TAG_READY)
> goto more;
> process_message(con);
> + if (con->state == CON_STATE_OPEN)
> + prepare_read_tag(con);
> goto more;
> }
> if (con->in_tag == CEPH_MSGR_TAG_ACK) {
>
next prev parent reply other threads:[~2012-07-31 0:11 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 [this message]
2012-07-30 15:59 ` [PATCH 6/8] libceph: avoid dropping con mutex before fault Sage Weil
2012-07-31 0:12 ` Alex Elder
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=5017229B.60805@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