Skip to content

Commit

Permalink
libceph: fix fault locking; close socket on lossy fault
Browse files Browse the repository at this point in the history
If we fault on a lossy connection, we should still close the socket
immediately, and do so under the con mutex.

We should also take the con mutex before printing out the state bits in
the debug output.

Signed-off-by: Sage Weil <sage@inktank.com>
  • Loading branch information
Sage Weil committed Jul 31, 2012
1 parent 070c633 commit 3b5ede0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions net/ceph/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -2330,22 +2330,23 @@ static void con_work(struct work_struct *work)
*/
static void ceph_fault(struct ceph_connection *con)
{
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",
con, con->state, ceph_pr_addr(&con->peer_addr.in_addr));

if (test_bit(LOSSYTX, &con->flags)) {
dout("fault on LOSSYTX channel\n");
goto out;
}

mutex_lock(&con->mutex);
if (test_bit(CLOSED, &con->state))
goto out_unlock;

con_close_socket(con);

if (test_bit(LOSSYTX, &con->flags)) {
dout("fault on LOSSYTX channel\n");
goto out_unlock;
}

if (con->in_msg) {
BUG_ON(con->in_msg->con != con);
con->in_msg->con = NULL;
Expand Down Expand Up @@ -2392,7 +2393,6 @@ static void ceph_fault(struct ceph_connection *con)

out_unlock:
mutex_unlock(&con->mutex);
out:
/*
* in case we faulted due to authentication, invalidate our
* current tickets so that we can get new ones.
Expand Down

0 comments on commit 3b5ede0

Please sign in to comment.