summaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-02-19 12:25:57 -0600
committerAlex Elder <elder@inktank.com>2013-02-25 15:37:32 -0600
commitb6e7b6a11923bda6102b4e3e196693567944869c (patch)
tree553eee6fd3a8c048c2fbc047d1629928ebe0bd2d /net/ceph
parent93209264203987cdd2c69d34df6eaa2cd184e283 (diff)
downloadblackbird-op-linux-b6e7b6a11923bda6102b4e3e196693567944869c.tar.gz
blackbird-op-linux-b6e7b6a11923bda6102b4e3e196693567944869c.zip
libceph: use a flag to indicate a fault has occurred
This just rearranges the logic in con_work() a little bit so that a flag is used to indicate a fault has occurred. This allows both the fault and non-fault case to be handled the same way and avoids a couple of nearly consecutive gotos. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/messenger.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index c3b9060d4844..18eb788bbb9d 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2387,13 +2387,15 @@ static void con_work(struct work_struct *work)
{
struct ceph_connection *con = container_of(work, struct ceph_connection,
work.work);
+ bool fault = false;
int ret;
mutex_lock(&con->mutex);
restart:
if (con_sock_closed(con)) {
dout("%s: con %p SOCK_CLOSED\n", __func__, con);
- goto fault;
+ fault = true;
+ goto done;
}
if (con_backoff(con)) {
dout("%s: con %p BACKOFF\n", __func__, con);
@@ -2418,7 +2420,8 @@ restart:
goto restart;
if (ret < 0) {
con->error_msg = "socket error on read";
- goto fault;
+ fault = true;
+ goto done;
}
ret = try_write(con);
@@ -2426,20 +2429,17 @@ restart:
goto restart;
if (ret < 0) {
con->error_msg = "socket error on write";
- goto fault;
+ fault = true;
}
-
done:
+ if (fault)
+ con_fault(con);
mutex_unlock(&con->mutex);
-done_unlocked:
- con->ops->put(con);
- return;
-fault:
- con_fault(con);
- mutex_unlock(&con->mutex);
- con_fault_finish(con);
- goto done_unlocked;
+ if (fault)
+ con_fault_finish(con);
+
+ con->ops->put(con);
}
OpenPOWER on IntegriCloud