From patchwork Mon Apr 27 17:13:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 6281991 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E4908BEEE1 for ; Mon, 27 Apr 2015 17:13:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E6D0203C2 for ; Mon, 27 Apr 2015 17:13:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C96C7203C1 for ; Mon, 27 Apr 2015 17:13:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964825AbbD0RNk (ORCPT ); Mon, 27 Apr 2015 13:13:40 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:35372 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753470AbbD0RNV (ORCPT ); Mon, 27 Apr 2015 13:13:21 -0400 Received: by pdbqd1 with SMTP id qd1so134961682pdb.2 for ; Mon, 27 Apr 2015 10:13:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=sSTiA4/kEnaHbp+tOo0fchrVL1JbsF4kc5foeXSFOeQ=; b=JuD98EmGPiIDEfhBpUGFyrM7gRkE+ufw7PYG9H1jGAh5X4U3Q9ZCFxh5iULpdZSPG7 CzAYUfLRtsl4pnLLlLXFxEuyjr1m6Q2FxT63FkO9L58TZdGJT3okJL6nvNrotlVpgO85 dZvxFzQQnIzuNTE3hPOC/hnSH4rHZL9JzYDe9NnThGVMCXHh6hVdn9ceTDix2z7OLm7V m0aDW+/XKCtooA72eE/XHy+otQmrFPl4Ynwd3Ydv5G5+HUqeNC1FCYsKqnE3PkOIbrD3 9BftA1V9cUCjUCh7gAM4HQJmDOWXyYtFI98xxj254v1QD41rnQ1UBGo2YUoW3KQwRLRL ChDw== X-Gm-Message-State: ALoCoQl1H0oqfiABHlEZHTf+bDruV9TnOujDE3xuMWB99e66SlXvyQxCBL6QlT0Zj3arkXUCi+pW X-Received: by 10.66.65.228 with SMTP id a4mr24379965pat.47.1430154801050; Mon, 27 Apr 2015 10:13:21 -0700 (PDT) Received: from shibby.corp.google.com ([104.135.1.105]) by mx.google.com with ESMTPSA id ff10sm12124675pab.13.2015.04.27.10.13.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Apr 2015 10:13:20 -0700 (PDT) From: Alex Elder To: ceph-devel@vger.kernel.org Subject: [PATCH 2/7] messenger: add some clarifying comments Date: Mon, 27 Apr 2015 12:13:10 -0500 Message-Id: <1430154795-17123-3-git-send-email-elder@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1430154795-17123-1-git-send-email-elder@linaro.org> References: <1430154795-17123-1-git-send-email-elder@linaro.org> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In con_sock_closed() we test *and* clear the socket closed connection flag. It's not immediately obvious why the flag needs to be cleared. Add a comment so that's a little clearer. Similarly, we only want to do backoff processing once each time the backoff flag is set. Add a comment about that as well. Signed-off-by: Alex Elder --- net/ceph/messenger.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 9dfdb20..37b0fa7 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -2733,6 +2733,10 @@ static void cancel_con(struct ceph_connection *con) static bool con_sock_closed(struct ceph_connection *con) { + /* + * We want to handle the event of the socket being + * closed once, so clear the flag in case it is set. + */ if (!con_flag_test_and_clear(con, CON_FLAG_SOCK_CLOSED)) return false; @@ -2764,6 +2768,11 @@ static bool con_backoff(struct ceph_connection *con) { int ret; + /* + * See if we need to back off. We only want to do this + * processing once each time the flag is set, so clear the + * flag after it's tested. + */ if (!con_flag_test_and_clear(con, CON_FLAG_BACKOFF)) return false;