From patchwork Mon May 17 16:29:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12262443 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53D9FC43461 for ; Mon, 17 May 2021 16:30:49 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E8A1B6100A for ; Mon, 17 May 2021 16:30:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E8A1B6100A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621269048; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=AFZq7eSnxQywK5MkDAcvXHpmV+/ZhDcVIfhcPOEQinI=; b=EeyWtp2sytjopMtfUaEaA9OKo2NWtfCgo6AoW+uqnwNWZp3eYclBkGjDeqwpdUe8IrqFeu oxJdk4dwixXUvIpExNTv9DePDHXKgn1OA4SeUtlKYOZMZEiZNt57Ch5U6PfrmKplgHx8H2 bGcEmf/meJBgNrXUjTncXyaG47UcK7c= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-586-66eNpE3VMtuL_UOsP68Bww-1; Mon, 17 May 2021 12:30:45 -0400 X-MC-Unique: 66eNpE3VMtuL_UOsP68Bww-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D61B9F7E0; Mon, 17 May 2021 16:30:40 +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 E557136D5; Mon, 17 May 2021 16:30: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 BC83D180B465; Mon, 17 May 2021 16:30:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14HGUakQ005217 for ; Mon, 17 May 2021 12:30:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4A54F60CD0; Mon, 17 May 2021 16:30:36 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F073F614FB; Mon, 17 May 2021 16:30:03 +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 14HGU2JT006322; Mon, 17 May 2021 11:30:02 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 14HGU13e006321; Mon, 17 May 2021 11:30:01 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 17 May 2021 11:29:54 -0500 Message-Id: <1621268999-6280-2-git-send-email-bmarzins@redhat.com> In-Reply-To: <1621268999-6280-1-git-send-email-bmarzins@redhat.com> References: <1621268999-6280-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v4 1/6] multipathd: don't fail to remove path once the map is removed 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com In ev_remove_path(), if update_mpp_paths() fails, we delete the entire map. However, since update_mpp_paths() happens before we call set_path_removed(), pp->initialized isn't set to INIT_REMOVED, so remove_map_and_stop_waiter() doesn't remove the path when in removes the map. But with the map removed, there's nothing to keep us from removing the path. Call set_path_removed() before update_mpp_paths() to avoid the odd case of ev_remove_path() removing the map but not the path. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/structs_vec.c | 4 ++-- multipathd/main.c | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index d242c06b..75390198 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -45,8 +45,8 @@ int update_mpp_paths(struct multipath *mpp, vector pathvec) /* * Avoid adding removed paths to the map again - * when we reload it. Such paths may exist if - * domap fails in ev_remove_path(). + * when we reload it. Such paths may exist in + * ev_remove_paths() or if it returns failure. */ pp1 = find_path_by_devt(pathvec, pp->dev_t); if (pp1 && pp->initialized != INIT_REMOVED && diff --git a/multipathd/main.c b/multipathd/main.c index 102946bf..449ce384 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1199,6 +1199,13 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) * avoid referring to the map of an orphaned path */ if ((mpp = pp->mpp)) { + /* + * Mark the path as removed. In case of success, we + * will delete it for good. Otherwise, it will be deleted + * later, unless all attempts to reload this map fail. + */ + set_path_removed(pp); + /* * transform the mp->pg vector of vectors of paths * into a mp->params string to feed the device-mapper @@ -1210,13 +1217,9 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) } /* - * Mark the path as removed. In case of success, we - * will delete it for good. Otherwise, it will be deleted - * later, unless all attempts to reload this map fail. - * Note: we have to explicitly remove pp from mpp->paths, + * we have to explicitly remove pp from mpp->paths, * update_mpp_paths() doesn't do that. */ - set_path_removed(pp); i = find_slot(mpp->paths, pp); if (i != -1) vector_del_slot(mpp->paths, i); From patchwork Mon May 17 16:29:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12262441 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ABC6C43460 for ; Mon, 17 May 2021 16:30:47 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB56861059 for ; Mon, 17 May 2021 16:30:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB56861059 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621269045; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kV7MYd9rMGAfbP6NW97s/QCKumTCeIGbb5KODDJ1Wx0=; b=Q6ggijfc5tqq3fXnor72jfYkFeCBv8sL8ysAyLziYNBOG/RcYE16Z1b9KSJNLbpwNJcX5N nhBWfHxVWP1E8GJWWDXzytB8r0AvkwPSnfU3R8uiYcYwcl/mWkvYLPKSF7E2NyM6Ihj04f COh1S7LPQK2DTfS8by2YL5dp2g2Ka98= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-123-2S9a85u0OpOtwWZicyZ0bA-1; Mon, 17 May 2021 12:30:43 -0400 X-MC-Unique: 2S9a85u0OpOtwWZicyZ0bA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 993A118C35C5; Mon, 17 May 2021 16:30:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8014B1B472; Mon, 17 May 2021 16:30:37 +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 52D915534B; Mon, 17 May 2021 16:30:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14HGUaVW005218 for ; Mon, 17 May 2021 12:30:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4B88A687C9; Mon, 17 May 2021 16:30:36 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09A7F687D4; Mon, 17 May 2021 16:30:04 +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 14HGU3uF006326; Mon, 17 May 2021 11:30:03 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 14HGU2ZX006325; Mon, 17 May 2021 11:30:02 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 17 May 2021 11:29:55 -0500 Message-Id: <1621268999-6280-3-git-send-email-bmarzins@redhat.com> In-Reply-To: <1621268999-6280-1-git-send-email-bmarzins@redhat.com> References: <1621268999-6280-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v4 2/6] multipathd: remove duplicate orphan_paths in flush_map 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com remove_map_and_stop_waiter() already calls orphan_paths() so flush_map() doesn't need to call orphan_paths() before calling remove_map_and_stop_waiter(). Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipathd/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index 449ce384..6090434c 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -660,7 +660,6 @@ flush_map(struct multipath * mpp, struct vectors * vecs, int nopaths) else condlog(2, "%s: map flushed", mpp->alias); - orphan_paths(vecs->pathvec, mpp, "map flushed"); remove_map_and_stop_waiter(mpp, vecs); return 0; From patchwork Mon May 17 16:29:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12262439 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AB98C433B4 for ; Mon, 17 May 2021 16:30:47 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB2D060FD9 for ; Mon, 17 May 2021 16:30:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB2D060FD9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621269046; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=q7Vxg2Xu27QuS4TrnJ4iCOIwZWi3u2bvkwlWeFJU1Es=; b=icHW7jNKvTwBg7+R7Dybgs1P3KJSVfx7t4xhoiGW/DGefoz17ZTdWLYhC7vb0zJmBl4NhC UJZhb5TxNn76WAe9Sl5buUlp9gRKR0SNI11fKLdBJVtvQthNu2gD7IxONWfLNZe9l7XSkC kZGXGBJAqTvE3cHvoF5tOiMdyJuxwAM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-75-vRDCYvxJMIyMyGoGql3UKw-1; Mon, 17 May 2021 12:30:43 -0400 X-MC-Unique: vRDCYvxJMIyMyGoGql3UKw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 686338015F7; Mon, 17 May 2021 16:30:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CC15226F1; Mon, 17 May 2021 16:30: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 1ABE855350; Mon, 17 May 2021 16:30:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14HGUaiU005227 for ; Mon, 17 May 2021 12:30:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 648DB5C1A1; Mon, 17 May 2021 16:30:36 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 32C595C239; Mon, 17 May 2021 16:30:06 +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 14HGU4l3006330; Mon, 17 May 2021 11:30:04 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 14HGU4HP006329; Mon, 17 May 2021 11:30:04 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 17 May 2021 11:29:56 -0500 Message-Id: <1621268999-6280-4-git-send-email-bmarzins@redhat.com> In-Reply-To: <1621268999-6280-1-git-send-email-bmarzins@redhat.com> References: <1621268999-6280-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v4 3/6] multipathd: fix ev_remove_path return code handling 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com When ev_remove_path() returned success, callers assumed that the path (and possibly the map) had been removed. When ev_remove_path() returned failure, callers assumed that the path had not been removed. However, the path could be removed on both success or failure. This could cause callers to dereference the path after it was removed. To deal with this, make ev_remove_path() return a different symbolic value for each outcome, and make the callers react appropriately for the different values. Found by coverity. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipathd/cli_handlers.c | 24 +++++++++++++++++++++-- multipathd/main.c | 41 ++++++++++++++++++++------------------- multipathd/main.h | 14 +++++++++++++ 3 files changed, 57 insertions(+), 22 deletions(-) diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index 1de6ad8e..6765fcf0 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -752,7 +752,8 @@ cli_add_path (void * v, char ** reply, int * len, void * data) /* Have the checker reinstate this path asap */ pp->tick = 1; return 0; - } else if (!ev_remove_path(pp, vecs, true)) + } else if (ev_remove_path(pp, vecs, true) & + REMOVE_PATH_SUCCESS) /* Path removed in ev_remove_path() */ pp = NULL; else { @@ -813,6 +814,7 @@ cli_del_path (void * v, char ** reply, int * len, void * data) struct vectors * vecs = (struct vectors *)data; char * param = get_keyparam(v, PATH); struct path *pp; + int ret; param = convert_dev(param, 1); condlog(2, "%s: remove path (operator)", param); @@ -821,7 +823,25 @@ cli_del_path (void * v, char ** reply, int * len, void * data) condlog(0, "%s: path already removed", param); return 1; } - return ev_remove_path(pp, vecs, 1); + ret = ev_remove_path(pp, vecs, 1); + if (ret == REMOVE_PATH_DELAY) { + *reply = strdup("delayed\n"); + if (*reply) + *len = strlen(*reply) + 1; + else { + *len = 0; + ret = REMOVE_PATH_FAILURE; + } + } else if (ret == REMOVE_PATH_MAP_ERROR) { + *reply = strdup("map reload error. removed\n"); + if (*reply) + *len = strlen(*reply) + 1; + else { + *len = 0; + ret = REMOVE_PATH_FAILURE; + } + } + return (ret == REMOVE_PATH_FAILURE); } int diff --git a/multipathd/main.c b/multipathd/main.c index 6090434c..8e2beddd 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -838,7 +838,7 @@ handle_path_wwid_change(struct path *pp, struct vectors *vecs) return; udd = udev_device_ref(pp->udev); - if (ev_remove_path(pp, vecs, 1) != 0 && pp->mpp) { + if (!(ev_remove_path(pp, vecs, 1) & REMOVE_PATH_SUCCESS) && pp->mpp) { pp->dmstate = PSTATE_FAILED; dm_fail_path(pp->mpp->alias, pp->dev_t); } @@ -948,8 +948,8 @@ uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map) * Make another attempt to remove the path */ pp->mpp = prev_mpp; - ret = ev_remove_path(pp, vecs, true); - if (ret != 0) { + if (!(ev_remove_path(pp, vecs, true) & + REMOVE_PATH_SUCCESS)) { /* * Failure in ev_remove_path will keep * path in pathvec in INIT_REMOVED state @@ -960,6 +960,7 @@ uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map) dm_fail_path(pp->mpp->alias, pp->dev_t); condlog(1, "%s: failed to re-add path still mapped in %s", pp->dev, pp->mpp->alias); + ret = 1; } else if (r == PATHINFO_OK) /* * Path successfully freed, move on to @@ -1167,7 +1168,6 @@ static int uev_remove_path (struct uevent *uev, struct vectors * vecs, int need_do_map) { struct path *pp; - int ret; condlog(3, "%s: remove path (uevent)", uev->kernel); delete_foreign(uev->udev); @@ -1177,21 +1177,18 @@ uev_remove_path (struct uevent *uev, struct vectors * vecs, int need_do_map) pthread_testcancel(); pp = find_path_by_dev(vecs->pathvec, uev->kernel); if (pp) - ret = ev_remove_path(pp, vecs, need_do_map); + ev_remove_path(pp, vecs, need_do_map); lock_cleanup_pop(vecs->lock); - if (!pp) { - /* Not an error; path might have been purged earlier */ + if (!pp) /* Not an error; path might have been purged earlier */ condlog(0, "%s: path already removed", uev->kernel); - return 0; - } - return ret; + return 0; } int ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) { struct multipath * mpp; - int i, retval = 0; + int i, retval = REMOVE_PATH_SUCCESS; char params[PARAMS_SIZE] = {0}; /* @@ -1245,7 +1242,6 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) condlog(2, "%s: removed map after" " removing all paths", alias); - retval = 0; /* flush_map() has freed the path */ goto out; } @@ -1262,11 +1258,14 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) if (mpp->wait_for_udev) { mpp->wait_for_udev = 2; + retval = REMOVE_PATH_DELAY; goto out; } - if (!need_do_map) + if (!need_do_map) { + retval = REMOVE_PATH_DELAY; goto out; + } /* * reload the map */ @@ -1275,7 +1274,7 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) condlog(0, "%s: failed in domap for " "removal of path %s", mpp->alias, pp->dev); - retval = 1; + retval = REMOVE_PATH_FAILURE; } else { /* * update our state from kernel @@ -1283,12 +1282,12 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) char devt[BLK_DEV_SIZE]; strlcpy(devt, pp->dev_t, sizeof(devt)); + + /* setup_multipath will free the path + * regardless of whether it succeeds or + * fails */ if (setup_multipath(vecs, mpp)) - return 1; - /* - * Successful map reload without this path: - * sync_map_state() will free it. - */ + return REMOVE_PATH_MAP_ERROR; sync_map_state(mpp); condlog(2, "%s: path removed from map %s", @@ -1304,8 +1303,10 @@ out: return retval; fail: + condlog(0, "%s: error removing path. removing map %s", pp->dev, + mpp->alias); remove_map_and_stop_waiter(mpp, vecs); - return 1; + return REMOVE_PATH_MAP_ERROR; } static int diff --git a/multipathd/main.h b/multipathd/main.h index ddd953f9..bc1f938f 100644 --- a/multipathd/main.h +++ b/multipathd/main.h @@ -13,6 +13,20 @@ enum daemon_status { DAEMON_STATUS_SIZE, }; +enum remove_path_result { + REMOVE_PATH_FAILURE = 0x0, /* path could not be removed. It is still + * part of the kernel map, but its state + * is set to INIT_REMOVED, and it will be + * removed at the next possible occassion */ + REMOVE_PATH_SUCCESS = 0x1, /* path was removed */ + REMOVE_PATH_DELAY = 0x2, /* path is set to be removed later. it + * currently still exists and is part of the + * kernel map */ + REMOVE_PATH_MAP_ERROR = 0x5, /* map was removed because of error. value + * includes REMOVE_PATH_SUCCESS bit + * because the path was also removed */ +}; + struct prout_param_descriptor; struct prin_resp; From patchwork Mon May 17 16:29:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12262433 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FCBBC43460 for ; Mon, 17 May 2021 16:30:26 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D2EB561244 for ; Mon, 17 May 2021 16:30:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D2EB561244 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621269025; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MrMboESLP6K0GIIA10rhW2P+cBo+4wI+nRzAFMLUJGU=; b=Qy+7ct2eeOVL17kTept5RxM5UFb5u7VQ4wYKE/aU8T4CAo7VmEa4fnTW6SvLdBjoZh+47Q k4tNLyryDro12HiIe3L7DKXuAWXAOHYveYHmoQP2m6KHqYnQX811CTf8oz5MIRpoqGidU/ 4/mTgDCd9wIz0x+hMpQ3xRwMI4iZZOw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-450-AWLks05TOQy_d2qgLxY6Fw-1; Mon, 17 May 2021 12:30:23 -0400 X-MC-Unique: AWLks05TOQy_d2qgLxY6Fw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D890801107; Mon, 17 May 2021 16:30:19 +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 F23B42C1A9; Mon, 17 May 2021 16:30:18 +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 5AEDC1801029; Mon, 17 May 2021 16:30:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14HGUGeD004795 for ; Mon, 17 May 2021 12:30:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id C9F7C5D72F; Mon, 17 May 2021 16:30:16 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65D115D749; Mon, 17 May 2021 16:30:07 +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 14HGU57o006334; Mon, 17 May 2021 11:30:06 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 14HGU52c006333; Mon, 17 May 2021 11:30:05 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 17 May 2021 11:29:57 -0500 Message-Id: <1621268999-6280-5-git-send-email-bmarzins@redhat.com> In-Reply-To: <1621268999-6280-1-git-send-email-bmarzins@redhat.com> References: <1621268999-6280-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v4 4/6] multipath: free vectors in configure 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.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com configure() can retry multiple times, each time reallocing a maps and paths vector, and leaking the previous ones. Fix this by always freeing the vectors before configure() exits. Found by coverity. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipath/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/multipath/main.c b/multipath/main.c index ef89c7cf..8fc0e15f 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -466,7 +466,6 @@ configure (struct config *conf, enum mpath_cmds cmd, */ curmp = vector_alloc(); pathvec = vector_alloc(); - atexit(cleanup_vecs); if (!curmp || !pathvec) { condlog(0, "can not allocate memory"); @@ -578,6 +577,11 @@ out: if (refwwid) FREE(refwwid); + free_multipathvec(curmp, KEEP_PATHS); + vecs.mpvec = NULL; + free_pathvec(pathvec, FREE_PATHS); + vecs.pathvec = NULL; + return r; } @@ -823,6 +827,7 @@ main (int argc, char *argv[]) conf = get_multipath_config(); conf->retrigger_tries = 0; conf->force_sync = 1; + atexit(cleanup_vecs); while ((arg = getopt(argc, argv, ":adDcChl::eFfM:v:p:b:BrR:itTquUwW")) != EOF ) { switch(arg) { case 1: printf("optarg : %s\n",optarg); From patchwork Mon May 17 16:29:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12262435 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EEDAC43461 for ; Mon, 17 May 2021 16:30:27 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5E4E6100A for ; Mon, 17 May 2021 16:30:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5E4E6100A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621269026; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=L26z0X7mibby2s+FYZiCHw5sZkbAFMq4ypbAetjD07M=; b=DSLN7Lbsfpov2WpAKWxVjL2qbtPmevFxJiNEL7gBvYfeQb+5ZgrrA1NUNbUhJ5471UxSJn Q5WZOV6PbpfmqKV/pXyS2IyZ7AtFYxmF2/hooK/URHCaNjXC1mXglMcbyA8el81kyPfZGx Kdl1rByA9KZZTmvlCCLS7/ZCwKh+rWI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-490-a6vjKGdwNQyyyZ0xnwjgNQ-1; Mon, 17 May 2021 12:30:23 -0400 X-MC-Unique: a6vjKGdwNQyyyZ0xnwjgNQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8464C80ED8D; Mon, 17 May 2021 16:30:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A80D5D6D7; Mon, 17 May 2021 16:30:18 +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 97E2A55344; Mon, 17 May 2021 16:30:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14HGUFaJ004789 for ; Mon, 17 May 2021 12:30:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id C7C081899A; Mon, 17 May 2021 16:30:15 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC0C150EDE; Mon, 17 May 2021 16:30:08 +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 14HGU7WC006338; Mon, 17 May 2021 11:30:07 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 14HGU6C2006337; Mon, 17 May 2021 11:30:06 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 17 May 2021 11:29:58 -0500 Message-Id: <1621268999-6280-6-git-send-email-bmarzins@redhat.com> In-Reply-To: <1621268999-6280-1-git-send-email-bmarzins@redhat.com> References: <1621268999-6280-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v4 5/6] kpartx: Don't leak memory when getblock returns NULL 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com If a new block was allocated, but couldn't be filled, getblock will discard it. When it does so, it needs to free the block to avoid leaking memory. Found by coverity. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- kpartx/kpartx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c index 8ff116b8..7bc64543 100644 --- a/kpartx/kpartx.c +++ b/kpartx/kpartx.c @@ -766,6 +766,8 @@ getblock (int fd, unsigned int blknr) { if (read(fd, bp->block, secsz) != secsz) { fprintf(stderr, "read error, sector %d\n", secnr); blockhead = bp->next; + free(bp->block); + free(bp); return NULL; } From patchwork Mon May 17 16:29:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12262445 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E939DC433ED for ; Mon, 17 May 2021 16:30:51 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9353B60FD9 for ; Mon, 17 May 2021 16:30:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9353B60FD9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621269050; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=qsaTeCJxarrX7TZh9EhCzk78CTW/7WS5oR8w6thrfW4=; b=id9Wvcx/W9b+ROjMuYsyMdHajBu0XOMP8tHD1zbdyluVWg6mm/8UZU10mC3gbDytw3ex5K yNHBKjyNmSgnm13wze0R56WrJBetu/Dyphxv8kMNNyOu/9f/SFz17L5eulN/0Erm7TBp/+ swS4dDxzRhY4JmeYHrESBWGq8J1TBf4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-53-b0q66crUOpmWiJ6_3u-YJw-1; Mon, 17 May 2021 12:30:48 -0400 X-MC-Unique: b0q66crUOpmWiJ6_3u-YJw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 02B5B192205F; Mon, 17 May 2021 16:30:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DE87160C9B; Mon, 17 May 2021 16:30:41 +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 B060055353; Mon, 17 May 2021 16:30:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14HGUeIH005300 for ; Mon, 17 May 2021 12:30:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id BD9C450400; Mon, 17 May 2021 16:30:40 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EE81EBA63; Mon, 17 May 2021 16:30:09 +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 14HGU8SW006342; Mon, 17 May 2021 11:30:08 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 14HGU8hX006341; Mon, 17 May 2021 11:30:08 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 17 May 2021 11:29:59 -0500 Message-Id: <1621268999-6280-7-git-send-email-bmarzins@redhat.com> In-Reply-To: <1621268999-6280-1-git-send-email-bmarzins@redhat.com> References: <1621268999-6280-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v4 6/6] multipathd: don't rescan_path on wwid change in uev_update_path 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com If get_uid() is returning a different wwid in uev_update_path(), then the uid_attribute must have already gotten updated, which was the purpose behind calling rescan_path() in the first place. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipathd/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index 8e2beddd..2750f5e9 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1359,7 +1359,6 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) condlog(0, "%s: path wwid changed from '%s' to '%s'", uev->kernel, wwid, pp->wwid); ev_remove_path(pp, vecs, 1); - rescan_path(uev->udev); needs_reinit = 1; goto out; } else {