diff options
author | Alex Elder <elder@inktank.com> | 2013-02-19 13:25:57 -0500 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2013-02-25 16:37:32 -0500 |
commit | b6e7b6a11923bda6102b4e3e196693567944869c (patch) | |
tree | 553eee6fd3a8c048c2fbc047d1629928ebe0bd2d /net | |
parent | 93209264203987cdd2c69d34df6eaa2cd184e283 (diff) |
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')
-rw-r--r-- | net/ceph/messenger.c | 24 |
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) | |||
2387 | { | 2387 | { |
2388 | struct ceph_connection *con = container_of(work, struct ceph_connection, | 2388 | struct ceph_connection *con = container_of(work, struct ceph_connection, |
2389 | work.work); | 2389 | work.work); |
2390 | bool fault = false; | ||
2390 | int ret; | 2391 | int ret; |
2391 | 2392 | ||
2392 | mutex_lock(&con->mutex); | 2393 | mutex_lock(&con->mutex); |
2393 | restart: | 2394 | restart: |
2394 | if (con_sock_closed(con)) { | 2395 | if (con_sock_closed(con)) { |
2395 | dout("%s: con %p SOCK_CLOSED\n", __func__, con); | 2396 | dout("%s: con %p SOCK_CLOSED\n", __func__, con); |
2396 | goto fault; | 2397 | fault = true; |
2398 | goto done; | ||
2397 | } | 2399 | } |
2398 | if (con_backoff(con)) { | 2400 | if (con_backoff(con)) { |
2399 | dout("%s: con %p BACKOFF\n", __func__, con); | 2401 | dout("%s: con %p BACKOFF\n", __func__, con); |
@@ -2418,7 +2420,8 @@ restart: | |||
2418 | goto restart; | 2420 | goto restart; |
2419 | if (ret < 0) { | 2421 | if (ret < 0) { |
2420 | con->error_msg = "socket error on read"; | 2422 | con->error_msg = "socket error on read"; |
2421 | goto fault; | 2423 | fault = true; |
2424 | goto done; | ||
2422 | } | 2425 | } |
2423 | 2426 | ||
2424 | ret = try_write(con); | 2427 | ret = try_write(con); |
@@ -2426,20 +2429,17 @@ restart: | |||
2426 | goto restart; | 2429 | goto restart; |
2427 | if (ret < 0) { | 2430 | if (ret < 0) { |
2428 | con->error_msg = "socket error on write"; | 2431 | con->error_msg = "socket error on write"; |
2429 | goto fault; | 2432 | fault = true; |
2430 | } | 2433 | } |
2431 | |||
2432 | done: | 2434 | done: |
2435 | if (fault) | ||
2436 | con_fault(con); | ||
2433 | mutex_unlock(&con->mutex); | 2437 | mutex_unlock(&con->mutex); |
2434 | done_unlocked: | ||
2435 | con->ops->put(con); | ||
2436 | return; | ||
2437 | 2438 | ||
2438 | fault: | 2439 | if (fault) |
2439 | con_fault(con); | 2440 | con_fault_finish(con); |
2440 | mutex_unlock(&con->mutex); | 2441 | |
2441 | con_fault_finish(con); | 2442 | con->ops->put(con); |
2442 | goto done_unlocked; | ||
2443 | } | 2443 | } |
2444 | 2444 | ||
2445 | 2445 | ||