summaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-07-20 15:22:53 -0700
committerSage Weil <sage@inktank.com>2012-07-30 18:15:55 -0700
commit3b5ede07b55b52c3be27749d183d87257d032065 (patch)
tree7ea6b52c37dd8117b5fa67b5b193a2e70a05298c /net/ceph
parent070c633f60c23a89c226eb696f4a17b08a164b10 (diff)
downloadlinux-3b5ede07b55b52c3be27749d183d87257d032065.tar.bz2
libceph: fix fault locking; close socket on lossy fault
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>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/messenger.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 07204f19e856..9aaf539942ac 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2330,22 +2330,23 @@ fault:
*/
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;
@@ -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.