From patchwork Thu Apr 7 23:20:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 8778071 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D84899FC82 for ; Thu, 7 Apr 2016 23:23:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A8EB62020F for ; Thu, 7 Apr 2016 23:23:47 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A43ED2017D for ; Thu, 7 Apr 2016 23:23:46 +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 u37NL4qh028767; Thu, 7 Apr 2016 19:21:04 -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 u37NKZqb027981 for ; Thu, 7 Apr 2016 19:20:35 -0400 Received: from redhat.com (octiron.msp.redhat.com [10.15.80.209]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u37NKYBr021063; Thu, 7 Apr 2016 19:20:34 -0400 Received: by redhat.com (sSMTP sendmail emulation); Thu, 07 Apr 2016 18:20:34 -0500 From: "Benjamin Marzinski" To: device-mapper development Date: Thu, 7 Apr 2016 18:20:07 -0500 Message-Id: <1460071212-21018-14-git-send-email-bmarzins@redhat.com> In-Reply-To: <1460071212-21018-1-git-send-email-bmarzins@redhat.com> References: <1460071212-21018-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: dm-devel@redhat.com Cc: Christophe Varoqui Subject: [dm-devel] [PATCH v2 13/18] multipath: add exclusive_pref_bit for alua prio X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk 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.9 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 SCSI spec is pretty vague on exactly what the tpgs pref bit should guarantee. In the past, the alua prioritizer has put paths with the pref bit set in their own priority group, and some users complained. Currently, the alua prioritizer puts paths with the tpgs pref bit set in the highest priority path group. However, if the path with the pref bit set is active/optimized, it will be grouped with other active/optimized paths. Other users complained about this. The only good solution is to allow users to configure what setting the pref bit does. This patch allows user to set prio_args "exclusive_pref_bit" for the alua prioritizer. If this is set, a paths with the pref bit set will never get grouped with paths that don't have it set. If this is not set, multipath will continue to work as it currently does, where they may be grouped when all paths are active/optimized. Signed-off-by: Benjamin Marzinski --- libmultipath/prioritizers/alua.c | 20 +++++++++++++++++++- multipath/multipath.conf.5 | 19 ++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/libmultipath/prioritizers/alua.c b/libmultipath/prioritizers/alua.c index 0bd374f..cd4aafc 100644 --- a/libmultipath/prioritizers/alua.c +++ b/libmultipath/prioritizers/alua.c @@ -75,15 +75,33 @@ get_alua_info(struct path * pp) return rc; } +int get_exclusive_perf_arg(char *args) +{ + char *ptr; + + if (args == NULL) + return 0; + ptr = strstr(args, "exclusive_pref_bit"); + if (!ptr) + return 0; + if (ptr[18] != '\0' && ptr[18] != ' ' && ptr[18] != '\t') + return 0; + if (ptr != args && ptr[-1] != ' ' && ptr[-1] != '\t') + return 0; + return 1; +} + int getprio (struct path * pp, char * args) { int rc; int aas; int priopath; + int exclusive_perf; if (pp->fd < 0) return -ALUA_PRIO_NO_INFORMATION; + exclusive_perf = get_exclusive_perf_arg(args); rc = get_alua_info(pp); if (rc >= 0) { aas = (rc & 0x0f); @@ -104,7 +122,7 @@ int getprio (struct path * pp, char * args) default: rc = 0; } - if (priopath && aas != AAS_OPTIMIZED) + if (priopath && (aas != AAS_OPTIMIZED || exclusive_perf)) rc += 80; } else { switch(-rc) { diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 index 31c0eb8..7a4c452 100644 --- a/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5 @@ -193,7 +193,9 @@ Return a constant priority of \fI1\fR. Generate the path priority for EMC arrays. .TP .B alua -Generate the path priority based on the SCSI-3 ALUA settings. +Generate the path priority based on the SCSI-3 ALUA settings. This prioritizer +accepts the optional prio_arg +.I exclusive_pref_bit .TP .B ontap Generate the path priority for NetApp arrays. @@ -219,14 +221,25 @@ Default value is \fBnone\fR. .RE .TP .B prio_args -Arguments to pass to to the prio function. Currently only used with -.I weighted, which needs a value of the form +Arguments to pass to to the prio function. This only applies to certain +prioritizers +.RS +.TP 12 +.B weighted +Needs a value of the form .I " ..." .I hbtl regex can be of SCSI H:B:T:L format Ex: 1:0:.:. , *:0:0:. .I devname regex can be of device name format Ex: sda , sd.e .TP +.B alua +If +.I exclusive_pref_bit +is set, paths with the TPGS pref bit set will always be in their own path +group. +.RE +.TP .B features Specify any device-mapper features to be used. Syntax is .I num list