From patchwork Mon Oct 1 18:45:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10622649 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 519C1174A for ; Mon, 1 Oct 2018 18:45:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45DFA281C3 for ; Mon, 1 Oct 2018 18:45:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3973D28435; Mon, 1 Oct 2018 18:45:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9FD2D281C3 for ; Mon, 1 Oct 2018 18:45:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 406913001504; Mon, 1 Oct 2018 18:45:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B36047ADA4; Mon, 1 Oct 2018 18:45:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 882C3181A12F; Mon, 1 Oct 2018 18:45:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.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 w91IjTYt012332 for ; Mon, 1 Oct 2018 14:45:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 632022010DA9; Mon, 1 Oct 2018 18:45:29 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 798D42010D9A; Mon, 1 Oct 2018 18:45:26 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7479FC058CA8; Mon, 1 Oct 2018 18:45:24 +0000 (UTC) Received: from apollon.suse.de.de (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Mon, 01 Oct 2018 12:45:21 -0600 From: Martin Wilck To: Christophe Varoqui Date: Mon, 1 Oct 2018 20:45:06 +0200 Message-Id: <20181001184507.4162-2-mwilck@suse.com> In-Reply-To: <20181001184507.4162-1-mwilck@suse.com> References: <20181001184507.4162-1-mwilck@suse.com> MIME-Version: 1.0 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 01 Oct 2018 18:45:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 01 Oct 2018 18:45:25 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'mwilck@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH 1/2] libmultipath: allow sysfs_pathinfo to return SKIPPED 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: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 01 Oct 2018 18:45:35 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP The sysfs_pathinfo() code path can't distinguish between real failure and a devices that have to be skipped. One example for this are NVMe native multipath devices. This may cause lots of irritating log messages. Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 86 +++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 0b1855dd..0d94b333 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1156,20 +1156,20 @@ scsi_sysfs_pathinfo (struct path * pp, vector hwtable) parent = udev_device_get_parent(parent); } if (!attr_path || pp->sg_id.host_no == -1) - return 1; + return PATHINFO_FAILED; if (sysfs_get_vendor(parent, pp->vendor_id, SCSI_VENDOR_SIZE) <= 0) - return 1; + return PATHINFO_FAILED;; condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); if (sysfs_get_model(parent, pp->product_id, PATH_PRODUCT_SIZE) <= 0) - return 1; + return PATHINFO_FAILED;; condlog(3, "%s: product = %s", pp->dev, pp->product_id); if (sysfs_get_rev(parent, pp->rev, PATH_REV_SIZE) < 0) - return 1; + return PATHINFO_FAILED;; condlog(3, "%s: rev = %s", pp->dev, pp->rev); @@ -1192,12 +1192,12 @@ scsi_sysfs_pathinfo (struct path * pp, vector hwtable) * target node name */ if(sysfs_get_tgt_nodename(pp, pp->tgt_node_name)) - return 1; + return PATHINFO_FAILED; condlog(3, "%s: tgt_node_name = %s", pp->dev, pp->tgt_node_name); - return 0; + return PATHINFO_OK; } static int @@ -1209,17 +1209,17 @@ nvme_sysfs_pathinfo (struct path * pp, vector hwtable) attr_path = udev_device_get_sysname(pp->udev); if (!attr_path) - return 1; + return PATHINFO_FAILED; if (sscanf(attr_path, "nvme%dn%d", &pp->sg_id.host_no, &pp->sg_id.scsi_id) != 2) - return 1; + return PATHINFO_FAILED; parent = udev_device_get_parent_with_subsystem_devtype(pp->udev, "nvme", NULL); if (!parent) - return 1; + return PATHINFO_SKIPPED; attr = udev_device_get_sysattr_value(pp->udev, "nsid"); pp->sg_id.lun = attr ? atoi(attr) : 0; @@ -1242,7 +1242,7 @@ nvme_sysfs_pathinfo (struct path * pp, vector hwtable) find_hwe(hwtable, pp->vendor_id, pp->product_id, NULL, pp->hwe); - return 0; + return PATHINFO_OK; } static int @@ -1260,14 +1260,14 @@ ccw_sysfs_pathinfo (struct path * pp, vector hwtable) parent = udev_device_get_parent(parent); } if (!parent) - return 1; + return PATHINFO_FAILED; sprintf(pp->vendor_id, "IBM"); condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); if (sysfs_get_devtype(parent, attr_buff, FILE_NAME_SIZE) <= 0) - return 1; + return PATHINFO_FAILED; if (!strncmp(attr_buff, "3370", 4)) { sprintf(pp->product_id,"S/390 DASD FBA"); @@ -1301,7 +1301,7 @@ ccw_sysfs_pathinfo (struct path * pp, vector hwtable) pp->sg_id.lun); } - return 0; + return PATHINFO_OK; } static int @@ -1325,20 +1325,20 @@ cciss_sysfs_pathinfo (struct path * pp, vector hwtable) parent = udev_device_get_parent(parent); } if (!attr_path || pp->sg_id.host_no == -1) - return 1; + return PATHINFO_FAILED; if (sysfs_get_vendor(parent, pp->vendor_id, SCSI_VENDOR_SIZE) <= 0) - return 1; + return PATHINFO_FAILED; condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); if (sysfs_get_model(parent, pp->product_id, PATH_PRODUCT_SIZE) <= 0) - return 1; + return PATHINFO_FAILED; condlog(3, "%s: product = %s", pp->dev, pp->product_id); if (sysfs_get_rev(parent, pp->rev, PATH_REV_SIZE) <= 0) - return 1; + return PATHINFO_FAILED; condlog(3, "%s: rev = %s", pp->dev, pp->rev); @@ -1358,7 +1358,8 @@ cciss_sysfs_pathinfo (struct path * pp, vector hwtable) pp->sg_id.channel, pp->sg_id.scsi_id, pp->sg_id.lun); - return 0; + + return PATHINFO_OK; } static int @@ -1367,11 +1368,11 @@ common_sysfs_pathinfo (struct path * pp) dev_t devt; if (!pp) - return 1; + return PATHINFO_FAILED; if (!pp->udev) { condlog(4, "%s: udev not initialised", pp->dev); - return 1; + return PATHINFO_FAILED; } devt = udev_device_get_devnum(pp->udev); snprintf(pp->dev_t, BLK_DEV_SIZE, "%d:%d", major(devt), minor(devt)); @@ -1379,11 +1380,11 @@ common_sysfs_pathinfo (struct path * pp) condlog(3, "%s: dev_t = %s", pp->dev, pp->dev_t); if (sysfs_get_size(pp, &pp->size)) - return 1; + return PATHINFO_FAILED; condlog(3, "%s: size = %llu", pp->dev, pp->size); - return 0; + return PATHINFO_OK; } int @@ -1461,8 +1462,10 @@ path_offline (struct path * pp) int sysfs_pathinfo(struct path * pp, vector hwtable) { - if (common_sysfs_pathinfo(pp)) - return 1; + int r = common_sysfs_pathinfo(pp); + + if (r != PATHINFO_OK) + return r; pp->bus = SYSFS_BUS_UNDEF; if (!strncmp(pp->dev,"cciss",5)) @@ -1474,22 +1477,19 @@ sysfs_pathinfo(struct path * pp, vector hwtable) if (!strncmp(pp->dev,"nvme", 4)) pp->bus = SYSFS_BUS_NVME; - if (pp->bus == SYSFS_BUS_UNDEF) - return 0; - else if (pp->bus == SYSFS_BUS_SCSI) { - if (scsi_sysfs_pathinfo(pp, hwtable)) - return 1; - } else if (pp->bus == SYSFS_BUS_CCW) { - if (ccw_sysfs_pathinfo(pp, hwtable)) - return 1; - } else if (pp->bus == SYSFS_BUS_CCISS) { - if (cciss_sysfs_pathinfo(pp, hwtable)) - return 1; - } else if (pp->bus == SYSFS_BUS_NVME) { - if (nvme_sysfs_pathinfo(pp, hwtable)) - return 1; + switch (pp->bus) { + case SYSFS_BUS_SCSI: + return scsi_sysfs_pathinfo(pp, hwtable); + case SYSFS_BUS_CCW: + return ccw_sysfs_pathinfo(pp, hwtable); + case SYSFS_BUS_CCISS: + return cciss_sysfs_pathinfo(pp, hwtable); + case SYSFS_BUS_NVME: + return nvme_sysfs_pathinfo(pp, hwtable); + case SYSFS_BUS_UNDEF: + default: + return PATHINFO_OK; } - return 0; } static int @@ -1882,8 +1882,12 @@ int pathinfo(struct path *pp, struct config *conf, int mask) /* * fetch info available in sysfs */ - if (mask & DI_SYSFS && sysfs_pathinfo(pp, conf->hwtable)) - return PATHINFO_FAILED; + if (mask & DI_SYSFS) { + int rc = sysfs_pathinfo(pp, conf->hwtable); + + if (rc != PATHINFO_OK) + return rc; + } if (mask & DI_BLACKLIST && mask & DI_SYSFS) { if (filter_device(conf->blist_device, conf->elist_device, From patchwork Mon Oct 1 18:45:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10622651 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15259174A for ; Mon, 1 Oct 2018 18:45:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A859281C3 for ; Mon, 1 Oct 2018 18:45:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2A6828435; Mon, 1 Oct 2018 18:45:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A9D49281C3 for ; Mon, 1 Oct 2018 18:45:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F6E6552FC; Mon, 1 Oct 2018 18:45:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 322F12010D08; Mon, 1 Oct 2018 18:45:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CAB55181A12F; Mon, 1 Oct 2018 18:45:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w91IjbtX012363 for ; Mon, 1 Oct 2018 14:45:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id E50AF7ADA4; Mon, 1 Oct 2018 18:45:37 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DFB27B52B; Mon, 1 Oct 2018 18:45:35 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4BFDD81DF1; Mon, 1 Oct 2018 18:45:34 +0000 (UTC) Received: from apollon.suse.de.de (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Mon, 01 Oct 2018 12:45:22 -0600 From: Martin Wilck To: Christophe Varoqui Date: Mon, 1 Oct 2018 20:45:07 +0200 Message-Id: <20181001184507.4162-3-mwilck@suse.com> In-Reply-To: <20181001184507.4162-1-mwilck@suse.com> References: <20181001184507.4162-1-mwilck@suse.com> MIME-Version: 1.0 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 214 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 01 Oct 2018 18:45:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 01 Oct 2018 18:45:34 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'mwilck@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH 2/2] multipathd: try SCSI persistent reservations for SCSI only 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: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 01 Oct 2018 18:45:40 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP This avoids error messages when PERSISTENT RESERVE IN ioctls are tried on non-SCSI devices. Signed-off-by: Martin Wilck --- multipathd/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/multipathd/main.c b/multipathd/main.c index cc493c18..43e255e0 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -3129,6 +3129,9 @@ int mpath_pr_event_handle(struct path *pp) pthread_attr_t attr; struct multipath * mpp; + if (pp->bus != SYSFS_BUS_SCSI) + return 0; + mpp = pp->mpp; if (!get_be64(mpp->reservation_key))