Project

General

Profile

Actions

Bug #2424

closed

ceph-client: messenger: badness in prepare_write_connect()

Added by Alex Elder almost 12 years ago. Updated almost 12 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
% Done:

0%

Source:
Development
Tags:
Backport:
Regression:
Severity:
Reviewed:
Affected Versions:
ceph-qa-suite:
Crash signature (v1):
Crash signature (v2):

Description

At the end of prepare_write_connect() there is a call to prepare_connect_authorizer().
That function gets an authorizer for a connection (if a get_authorizer method is
defined), updates the connection's out_connect fields related to the authorizer, and
then appends the authorization buffer to the connection's out_kvec. The get_authorizer
method has to be called without the mutex held, so it is dropped for its duration and
reacquired afterward.

There are a couple of things wrong with this.
- prepare_connect_authorizer() can return EAGAIN. However by the time this has
occurred, prepare_write_connect will have already put the connection header in
out_kvec and marked the connection WRITE_PENDING. (This situation may well
correct itself, but it's not good.)
The two authorization fields in out_connect are updated after dropping and
re-acquiring the mutex. While the mutex was not held it's possible that the
connection header in out_connect (which has already been queued to send) has
already been sent out, so the updated values will not be seen by the receiver.
- The authorization buffer similarly will be queued for sending after having
dropped the mutex, so the already-sent header may not properly describe it,
and will I suspect lead to a protocol error.

The main thing that needs to occur is that the connection header should not
be queued to send until its fields are completely filled, meaning the info
about the authorization buffer needs to be known before doing so. Holding off
setting WRITE_PENDING until they are both queued also wouldn't hurt.

I came across this while tweaking this section of code, and have a fix that
is built on top of a little restructuring of this area of code.

Actions #1

Updated by Alex Elder almost 12 years ago

  • Status changed from New to Resolved

This bug was fixed in May, by a small series of changes that
culminated in this one:

commit 3da54776e2c0385c32d143fd497a7f40a88e29dd
Author: Alex Elder <>
Date: Wed May 16 15:16:39 2012 -0500
ceph: add auth buf in prepare_write_connect()
Actions

Also available in: Atom PDF