From patchwork Thu Mar 14 14:08:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 2271441 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by patchwork2.kernel.org (Postfix) with ESMTP id 059BBDFB79 for ; Thu, 14 Mar 2013 14:12:43 +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 r2EE9u9t008538; Thu, 14 Mar 2013 10:09:56 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r2EE96SH021426 for ; Thu, 14 Mar 2013 10:09:06 -0400 Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.20]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2EE962t024483 for ; Thu, 14 Mar 2013 10:09:06 -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 r2EE8o0S032480 for ; Thu, 14 Mar 2013 10:08:51 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E8223A5233; Thu, 14 Mar 2013 15:08:49 +0100 (CET) From: Hannes Reinecke To: dm-devel@redhat.com Date: Thu, 14 Mar 2013 15:08:44 +0100 Message-Id: <1363270128-20900-3-git-send-email-hare@suse.de> In-Reply-To: <1363270128-20900-1-git-send-email-hare@suse.de> References: <1363270128-20900-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -9.302 (BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.20 X-loop: dm-devel@redhat.com Cc: Christophe Varoqui Subject: [dm-devel] [PATCH 2/6] 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 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.h | 5 +++++ libmultipath/checkers/tur.c | 2 +- libmultipath/discovery.c | 2 ++ libmultipath/print.c | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-) 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 050264e..58ce533 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1027,6 +1027,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 0e2c680..f40a721 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -332,6 +332,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"); }