From patchwork Sat Mar 30 06:05:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 10878103 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 2D4D115AC for ; Sat, 30 Mar 2019 06:08:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14FFC28FF5 for ; Sat, 30 Mar 2019 06:08:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 096CF291BD; Sat, 30 Mar 2019 06:08: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 A563A28FF5 for ; Sat, 30 Mar 2019 06:08:39 +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 EDEBB5F7B5; Sat, 30 Mar 2019 06:08:38 +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 D013A5D9CC; Sat, 30 Mar 2019 06:08:38 +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 A358318033A2; Sat, 30 Mar 2019 06:08:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2U66NUM008525 for ; Sat, 30 Mar 2019 02:06:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0BBC4282D1; Sat, 30 Mar 2019 06:06:23 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9FE21A916; Sat, 30 Mar 2019 06:06:22 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id x2U66LhS021024; Sat, 30 Mar 2019 01:06:21 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id x2U66Kb4021023; Sat, 30 Mar 2019 01:06:20 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Sat, 30 Mar 2019 01:05:56 -0500 Message-Id: <1553925966-20958-8-git-send-email-bmarzins@redhat.com> In-Reply-To: <1553925966-20958-1-git-send-email-bmarzins@redhat.com> References: <1553925966-20958-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v3 07/17] multipathd: ignore failed wwid recheck 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-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.39]); Sat, 30 Mar 2019 06:08:39 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP If disable_changed_wwids is set, when multipathd gets a change event on a path, it verifies that the wwid hasn't changed in uev_update_path(). If get_uid() failed, uev_update_path treated this as a wwid change to 0. This could cause paths to suddenly be dropped due to an issue with getting the wwid. Even if get_uid() failed because the path was down, it no change uevent happend when it later became active, multipathd would continue to ignore the path. Also, scsi_uid_fallback() clears the failure return if it doesn't attempt to fallback, causing get_uid() to return success, when it actually failed. Multipathd should neither set nor clear wwid_changed if get_uid() returned failure. Also, scsi_uid_fallback() should retain the old return value if it doesn't attempt to fallback. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/discovery.c | 6 +++--- multipathd/main.c | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 729bcb9..b08cb2d 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1755,9 +1755,9 @@ get_vpd_uid(struct path * pp) } static ssize_t scsi_uid_fallback(struct path *pp, int path_state, - const char **origin) + const char **origin, ssize_t old_len) { - ssize_t len = 0; + ssize_t len = old_len; int retrigger; struct config *conf; @@ -1828,7 +1828,7 @@ get_uid (struct path * pp, int path_state, struct udev_device *udev) origin = "sysfs"; } if (len <= 0 && pp->bus == SYSFS_BUS_SCSI) - len = scsi_uid_fallback(pp, path_state, &origin); + len = scsi_uid_fallback(pp, path_state, &origin, len); } if ( len < 0 ) { condlog(1, "%s: failed to get %s uid: %s", diff --git a/multipathd/main.c b/multipathd/main.c index 678ecf8..fd83a6a 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1234,9 +1234,11 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) goto out; strcpy(wwid, pp->wwid); - get_uid(pp, pp->state, uev->udev); + rc = get_uid(pp, pp->state, uev->udev); - if (strncmp(wwid, pp->wwid, WWID_SIZE) != 0) { + if (rc != 0) + strcpy(pp->wwid, wwid); + else if (strncmp(wwid, pp->wwid, WWID_SIZE) != 0) { condlog(0, "%s: path wwid changed from '%s' to '%s'. %s", uev->kernel, wwid, pp->wwid, (disable_changed_wwids ? "disallowing" :