From patchwork Wed Dec 11 06:42:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 3322551 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 47E3C9F384 for ; Wed, 11 Dec 2013 06:46:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A5012074E for ; Wed, 11 Dec 2013 06:46:52 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mail.kernel.org (Postfix) with ESMTP id A8947203F7 for ; Wed, 11 Dec 2013 06:46:51 +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 rBB6hv1v018592; Wed, 11 Dec 2013 01:43:57 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rBB6hLws012508 for ; Wed, 11 Dec 2013 01:43:21 -0500 Received: from dhcp80-209.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rBB6hLUb021183 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 11 Dec 2013 01:43:21 -0500 Received: from dhcp80-209.msp.redhat.com (localhost [127.0.0.1]) by dhcp80-209.msp.redhat.com (8.14.7/8.14.7) with ESMTP id rBB6hKf8001349; Wed, 11 Dec 2013 00:43:20 -0600 Received: (from bmarzins@localhost) by dhcp80-209.msp.redhat.com (8.14.7/8.14.7/Submit) id rBB6hK9U001343; Wed, 11 Dec 2013 00:43:20 -0600 From: Benjamin Marzinski To: device-mapper development Date: Wed, 11 Dec 2013 00:42:58 -0600 Message-Id: <1386744190-1295-5-git-send-email-bmarzins@redhat.com> In-Reply-To: <1386744190-1295-1-git-send-email-bmarzins@redhat.com> References: <1386744190-1295-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: dm-devel@redhat.com Cc: Christophe Varoqui Subject: [dm-devel] [PATCH 04/16] Don't detect prioritizers that don't work 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.1 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 current method used by detect_prio was selecting the ALUA prioritizer for devices that didn't have ALUA enabled. This patch makes detect_prio go through all the steps to get a priority with the ALUA prioritizer. If it is able to successfully get a priority, then it selects the ALUA proritizer for the device. Signed-off-by: Benjamin Marzinski --- libmultipath/propsel.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c index 211ebcd..df09603 100644 --- a/libmultipath/propsel.c +++ b/libmultipath/propsel.c @@ -396,10 +396,17 @@ select_getuid (struct path * pp) void detect_prio(struct path * pp) { + int ret; struct prio *p = &pp->prio; - if (get_target_port_group_support(pp->fd) > 0) - prio_get(p, PRIO_ALUA, DEFAULT_PRIO_ARGS); + if (get_target_port_group_support(pp->fd) <= 0) + return; + ret = get_target_port_group(pp->fd); + if (ret < 0) + return; + if (get_asymmetric_access_state(pp->fd, ret) < 0) + return; + prio_get(p, PRIO_ALUA, DEFAULT_PRIO_ARGS); } extern int