From patchwork Fri Feb 22 17:26:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2176721 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 629283FD4E for ; Fri, 22 Feb 2013 17:26:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758035Ab3BVR0k (ORCPT ); Fri, 22 Feb 2013 12:26:40 -0500 Received: from mail-ie0-f169.google.com ([209.85.223.169]:60612 "EHLO mail-ie0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757929Ab3BVR0k (ORCPT ); Fri, 22 Feb 2013 12:26:40 -0500 Received: by mail-ie0-f169.google.com with SMTP id 13so1004611iea.14 for ; Fri, 22 Feb 2013 09:26:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=VzZXtuOTG/jYNsUG1AmLlkTJjp3LtsbaIIwCaIY/4zk=; b=LB3LNzOQ136AStoox/8QOYpk3nvCD/goLU61LD8C7mBjc14s4FTXRnhF+nytOlZSP2 2cZCKpz0/T7x2i/51UXiu7Ir72EykxWa5SHCy8KlqsZ0SpNOOJphB3+k/vlE1w2PC9hj dEEgB4l0s6kkGq6/qNWgmK1F/Q55bczyKBknygsdAzqPj1jsfa3tj0KzXHR/2T4aOyKa E4CxSklzHekEJg4eS898kw+MgBLfv1SfQgotHoL7D8fJLS2SMVNFVE7xB70LDSoN5dxv p2JmWViCMM72KhX501Sz1fWo6Z4j3c2I8ZZehOZbmY18J4HjC6nST4wbzIquQ154DlMh oMnw== X-Received: by 10.42.215.196 with SMTP id hf4mr1087591icb.23.1361553999912; Fri, 22 Feb 2013 09:26:39 -0800 (PST) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id vb15sm2061492igb.9.2013.02.22.09.26.38 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Feb 2013 09:26:38 -0800 (PST) Message-ID: <5127AA4D.0@inktank.com> Date: Fri, 22 Feb 2013 11:26:37 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: "ceph-devel@vger.kernel.org >> ceph-devel" Subject: [PATCH 3/5, v2] libceph: use a flag to indicate a fault has occurred References: <5127A85D.1070000@inktank.com> <5127A935.8020605@inktank.com> In-Reply-To: <5127A935.8020605@inktank.com> X-Gm-Message-State: ALoCoQmRjL5Y/7JUki+q7ZastxG4huPI9yni2omiCkWq4LpSZOO3gZXugPce1buIyvpVZpytT5Pc Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org 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 --- v2: rebased net/ceph/messenger.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index c3b9060..18eb788 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); }