From patchwork Sat Oct 4 00:11:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 5031971 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BCFECC11AC for ; Sat, 4 Oct 2014 01:21:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D643720219 for ; Sat, 4 Oct 2014 01:21:15 +0000 (UTC) Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CDEC7200ED for ; Sat, 4 Oct 2014 01:21:14 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s941Hbcj018645; Fri, 3 Oct 2014 21:17:37 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s941GX9q024786 for ; Fri, 3 Oct 2014 21:16:33 -0400 Received: from redhat.com (ask-08.lab.msp.redhat.com [10.15.85.8]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id s941GV6M008429; Fri, 3 Oct 2014 21:16:31 -0400 Received: by redhat.com (sSMTP sendmail emulation); Fri, 03 Oct 2014 19:11:25 -0500 From: "Benjamin Marzinski" To: device-mapper development Date: Fri, 3 Oct 2014 19:11:21 -0500 Message-Id: <1412381483-15757-2-git-send-email-bmarzins@redhat.com> In-Reply-To: <1412381483-15757-1-git-send-email-bmarzins@redhat.com> References: <1412381483-15757-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: dm-devel@redhat.com Cc: Christophe Varoqui Subject: [dm-devel] [PATCH 1/3] libmultipath: replace PATH_TIMEOUT with PATH_DOWN X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 The way the code works, PATH_TIMEOUT is treated mostly like PATH_UP or PATH_GHOST by check_path. If the the path was previously failed, it will even reinstate the path. It will also trigger prio refreshing. It seems that PATH_TIMEOUT should be at least as serious as PATH_PENDING, but the way the code works, it's not. In pathinfo, PATH_TIMEOUT gets changed directly to PATH_DOWN, which makes sense. But assuming that's the correct thing to do, why have PATH_TIMEOUT at all? The only thing that it does that seems helpful is that when you print out the path, instead of it saying that the path is down, it says that the path has timed out. But if we are going to treat is like the path is down, then I don't see this being too helpful. And the way we are treating PATH_TIMEOUT right now is definitely not right. This patch just pulls out the PATH_TIMEOUT code and replaces it with PATH_DOWN. I'm not adverse to the PATH_TIMEOUT state existing if it worked correctly, but I'm not sure what it's for. Cc: "Hannes Reinecke " Signed-off-by: Benjamin Marzinski --- libmultipath/checkers.c | 1 - libmultipath/checkers.h | 5 ----- libmultipath/checkers/tur.c | 5 ++--- libmultipath/discovery.c | 2 -- libmultipath/print.c | 2 -- 5 files changed, 2 insertions(+), 13 deletions(-) diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c index 4a4cd7c..d98b781 100644 --- a/libmultipath/checkers.c +++ b/libmultipath/checkers.c @@ -17,7 +17,6 @@ char *checker_state_names[] = { "shaky", "ghost", "pending", - "timeout", "removed", }; diff --git a/libmultipath/checkers.h b/libmultipath/checkers.h index e62b52f..338b792 100644 --- a/libmultipath/checkers.h +++ b/libmultipath/checkers.h @@ -47,10 +47,6 @@ * - Use: All async checkers * - Description: Indicates a check IO is in flight. * - * PATH_TIMEOUT: - * - Use: Only tur checker - * - Description: Command timed out - * * PATH REMOVED: * - Use: All checkers * - Description: Device has been removed from the system @@ -63,7 +59,6 @@ enum path_check_state { PATH_SHAKY, PATH_GHOST, PATH_PENDING, - PATH_TIMEOUT, PATH_REMOVED, PATH_MAX_STATE }; diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c index bd7372d..b0bff21 100644 --- a/libmultipath/checkers/tur.c +++ b/libmultipath/checkers/tur.c @@ -297,7 +297,7 @@ libcheck_check (struct checker * c) pthread_cancel(ct->thread); ct->running = 0; MSG(c, MSG_TUR_TIMEOUT); - tur_status = PATH_TIMEOUT; + tur_status = PATH_DOWN; } else { condlog(3, "%d:%d: tur checker not finished", TUR_DEVT(ct)); @@ -314,11 +314,10 @@ libcheck_check (struct checker * c) pthread_mutex_unlock(&ct->lock); } else { if (ct->thread) { - /* pthread cancel failed. continue in sync mode */ pthread_mutex_unlock(&ct->lock); condlog(3, "%d:%d: tur thread not responding", TUR_DEVT(ct)); - return PATH_TIMEOUT; + return PATH_DOWN; } /* Start new TUR checker */ ct->state = PATH_UNCHECKED; diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index af2aa20..b3232b2 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1218,8 +1218,6 @@ pathinfo (struct path *pp, vector hwtable, int mask) if (pp->state == PATH_UNCHECKED || pp->state == PATH_WILD) goto blank; - if (pp->state == PATH_TIMEOUT) - pp->state = PATH_DOWN; } else { condlog(3, "%s: path inaccessible", pp->dev); pp->chkrstate = pp->state = path_state; diff --git a/libmultipath/print.c b/libmultipath/print.c index 383eae4..9d204e8 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -338,8 +338,6 @@ snprint_chk_state (char * buff, size_t len, struct path * pp) return snprintf(buff, len, "ghost"); case PATH_PENDING: return snprintf(buff, len, "i/o pending"); - case PATH_TIMEOUT: - return snprintf(buff, len, "i/o timeout"); default: return snprintf(buff, len, "undef"); }