From: "Jim Schutt" <jaschut@sandia.gov>
To: Alex Elder <elder@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH 3.6-rc1] libceph: ensure banner is written on client connect before feature negotiation starts
Date: Thu, 9 Aug 2012 11:12:45 -0600 [thread overview]
Message-ID: <5023EF8D.90100@sandia.gov> (raw)
In-Reply-To: <50230EB9.1070302@inktank.com>
On 08/08/2012 07:13 PM, Alex Elder wrote:
> On 08/08/2012 11:09 AM, Jim Schutt wrote:
>> Because the Ceph client messenger uses a non-blocking connect, it is possible
>> for the sending of the client banner to race with the arrival of the banner
>> sent by the peer.
>
> This is possible because the server-side messenger immediately sends
> its banner and addresses after accepting a connect request, *before*
> actually attempting to read or verify the banner from the client.
It just occurred to me this really should be added to the commit
message if you take the patch. I can resend with it added, or
you can add it when you commit the patch.
Thanks for verifying this aspect of what's happening.
>
>> When ceph_sock_state_change() notices the connect has completed, it schedules
>> work to process the socket via con_work(). During this time the peer is
>> writing its banner, and arrival of the peer banner races with con_work().
>>
>> If con_work() calls try_read() before the peer banner arrives, there is
>> nothing for it to do, after which con_work() calls try_write() to send the
>> client's banner. In this case Ceph's protocol negotiation can complete
>> succesfully.
>>
>> If, however, the peer's banner arrives before con_work() calls try_read(),
>> then try_read() will read the banner and prepare protocol negotiation info via
>> prepare_write_connect(). prepare_write_connect() calls con_out_kvec_reset(),
>> which discards the as-yet-unsent client banner. Next, con_work() calls
>> try_write(), which sends the protocol negotiation info rather than the banner
>> that the peer is expecting.
>
> I believe your analysis is correct. And I think your solution sounds
> good as well. I think Sage was going to take a look at this also, and
> I'll wait for him to have a chance to comment. But in any case, your
> fix looks good. Nice job.
Thanks for taking a look.
-- Jim
prev parent reply other threads:[~2012-08-09 17:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-08 18:09 [PATCH 3.6-rc1] libceph: ensure banner is written on client connect before feature negotiation starts Jim Schutt
2012-08-09 1:13 ` Alex Elder
2012-08-09 17:12 ` Jim Schutt [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=5023EF8D.90100@sandia.gov \
--to=jaschut@sandia.gov \
--cc=ceph-devel@vger.kernel.org \
--cc=elder@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.