From patchwork Mon Jul 15 13:00:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 2827487 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 2A4DBC0AB2 for ; Mon, 15 Jul 2013 13:07:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E4FFC20163 for ; Mon, 15 Jul 2013 13:07:06 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mail.kernel.org (Postfix) with ESMTP id 9C31520164 for ; Mon, 15 Jul 2013 13:07:05 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r6FD22KQ015512; Mon, 15 Jul 2013 09:02:02 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r6FD0cC3028936 for ; Mon, 15 Jul 2013 09:00:38 -0400 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r6FD0b5j008315 for ; Mon, 15 Jul 2013 09:00:38 -0400 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6FD0agI031277 for ; Mon, 15 Jul 2013 09:00:36 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 80D00A531D; Mon, 15 Jul 2013 15:00:34 +0200 (CEST) From: Hannes Reinecke To: Christophe Varoqui Date: Mon, 15 Jul 2013 15:00:07 +0200 Message-Id: <1373893230-26077-7-git-send-email-hare@suse.de> In-Reply-To: <1373893230-26077-1-git-send-email-hare@suse.de> References: <1373893230-26077-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.69 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 06/29] libmultipath: Implement PATH_TIMEOUT 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=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 tur checker might run into a timeout, eg when a command is sent but the checker hasn't been able to receive a reply in time. Use a specific 'PATH_TIMEOUT' state for these cases. Signed-off-by: Hannes Reinecke --- libmultipath/checkers.c | 3 ++- libmultipath/checkers.h | 5 +++++ libmultipath/checkers/tur.c | 2 +- libmultipath/discovery.c | 2 ++ libmultipath/print.c | 4 ++++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c index 01dafdd..47f5c68 100644 --- a/libmultipath/checkers.c +++ b/libmultipath/checkers.c @@ -16,7 +16,8 @@ char *checker_state_names[] = { "up", "shaky", "ghost", - "pending" + "pending", + "timeout", }; static LIST_HEAD(checkers); diff --git a/libmultipath/checkers.h b/libmultipath/checkers.h index 5a96165..1b6c22d 100644 --- a/libmultipath/checkers.h +++ b/libmultipath/checkers.h @@ -46,6 +46,10 @@ * PATH_PENDING: * - Use: All async checkers * - Description: Indicates a check IO is in flight. + * + * PATH_TIMEOUT: + * - Use: Only tur checker + * - Description: Command timed out */ enum path_check_state { PATH_WILD, @@ -55,6 +59,7 @@ enum path_check_state { PATH_SHAKY, PATH_GHOST, PATH_PENDING, + PATH_TIMEOUT, PATH_MAX_STATE }; diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c index 9c141aa..6f5d4d9 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_DOWN; + tur_status = PATH_TIMEOUT; ct->state = PATH_UNCHECKED; } else { condlog(3, "%d:%d: tur checker not finished", diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 04c6029..6af5083 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1065,6 +1065,8 @@ 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 274f5e7..b6d08b7 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -335,6 +335,10 @@ snprint_chk_state (char * buff, size_t len, struct path * pp) return snprintf(buff, len, "shaky"); case PATH_GHOST: 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"); }