From patchwork Thu Jan 23 03:16:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13947909 X-Patchwork-Delegate: bmarzins@redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FABB335C0 for ; Thu, 23 Jan 2025 03:16:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602212; cv=none; b=m+/yrFhWu7KHiVC8/jXC/BJPaxxacXZsFKQOSNQ8yEW8fiyL42uOwG3QrqQAZmBd+m8E3D8NPhhhS79y5TF2wsCt+LKy2qkY95CZxjRcRXVYJP+vm3xCRr2XuhJ1qBi6eKOZ1isW/k8r7KaZAxIIYZlZTibFLGgZ1CyMh4vaSWk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602212; c=relaxed/simple; bh=Rc8c0WYM4d4Neh/an61UsAKlt374hKUq+G7+9WQccZ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=jVub9LKLmLv0lyLrlMlMmR4iyqmiqrZiI94nh2lLSzQ/4v0bmXsMDVMbQPpDwcNgfwtsqkUFbg9DQZd+d4vi9YlsxaW3wk7rp0ZuO7fDixLfbvi4SV7jyAiASaMc3xl+aI+EsSb8362t+f2RLZRKUqN8PSDKdsm0eyyUxf+LHsk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=AfCTgAuD; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AfCTgAuD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737602208; h=from:from: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; bh=PT7KLaYPdd4l4K1QlM6BEQHEzUGONO/W7yLtNRs4cxo=; b=AfCTgAuDroAj8qVy1B0z4UXEe8g0q68/4xQnYtZhgufIGbnN7JQKGy+3wsXNg8jUqh+q38 7D0YQIfljM3/z3VL6P0JXuDpsrxqNP6EqrN8iKK0dpw5FV/pUlZH5iHoaNe4oBU+jqAAFN r/HgV6AeTT0Ok4XeFzlEErjqG8Hvj5s= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-361-FAp82OcjMsG7LMGhXsagZw-1; Wed, 22 Jan 2025 22:16:46 -0500 X-MC-Unique: FAp82OcjMsG7LMGhXsagZw-1 X-Mimecast-MFC-AGG-ID: FAp82OcjMsG7LMGhXsagZw Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8095919560B9; Thu, 23 Jan 2025 03:16:45 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 49FEC19560AD; Thu, 23 Jan 2025 03:16:45 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 50N3GiLt3017917 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 22:16:44 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 50N3GiSl3017916; Wed, 22 Jan 2025 22:16:44 -0500 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 01/13] multipathd: use symbolic values for wait_for_udev Date: Wed, 22 Jan 2025 22:16:31 -0500 Message-ID: <20250123031643.3017891-2-bmarzins@redhat.com> In-Reply-To: <20250123031643.3017891-1-bmarzins@redhat.com> References: <20250123031643.3017891-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ZaJO0hSBV4K0J8djkBw2GCQyPiT0ZiuahKnm6yWZL4Q_1737602205 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true Signed-off-by: Benjamin Marzinski --- libmultipath/configure.c | 2 +- libmultipath/structs.h | 8 +++++++- multipathd/cli_handlers.c | 16 ++++++++-------- multipathd/main.c | 35 ++++++++++++++++++----------------- 4 files changed, 34 insertions(+), 27 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 191df1ef..534ca7f4 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -1018,7 +1018,7 @@ int domap(struct multipath *mpp, char *params, int is_daemon) mpp->action = ACT_NOTHING; else { conf = get_multipath_config(); - mpp->wait_for_udev = 1; + mpp->wait_for_udev = UDEV_WAIT_STARTED; mpp->uev_wait_tick = conf->uev_wait_timeout; put_multipath_config(conf); } diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 9d22bdd0..1b5a878b 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -430,6 +430,12 @@ enum prio_update_type { PRIO_UPDATE_MARGINAL, }; +enum udev_wait_states { + UDEV_WAIT_DONE = 0, + UDEV_WAIT_STARTED, + UDEV_WAIT_RELOAD, +}; + struct multipath { char wwid[WWID_SIZE]; char alias_old[WWID_SIZE]; @@ -441,7 +447,7 @@ struct multipath { int bestpg; int queuedio; int action; - int wait_for_udev; + enum udev_wait_states wait_for_udev; int uev_wait_tick; int pgfailback; int failback_tick; diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index 0849fe51..4bcc82ac 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -812,7 +812,7 @@ cli_reload(void *v, struct strbuf *reply, void *data) if (!mpp) return -ENODEV; - if (mpp->wait_for_udev) { + if (mpp->wait_for_udev != UDEV_WAIT_DONE) { condlog(2, "%s: device not fully created, failing reload", mpp->alias); return 1; @@ -841,7 +841,7 @@ cli_resize(void *v, struct strbuf *reply, void *data) if (!mpp) return -ENODEV; - if (mpp->wait_for_udev) { + if (mpp->wait_for_udev != UDEV_WAIT_DONE) { condlog(2, "%s: device not fully created, failing resize", mpp->alias); return 1; @@ -1046,7 +1046,7 @@ cli_suspend(void * v, struct strbuf *reply, void * data) if (!mpp) return 1; - if (mpp->wait_for_udev) { + if (mpp->wait_for_udev != UDEV_WAIT_DONE) { condlog(2, "%s: device not fully created, failing suspend", mpp->alias); return 1; @@ -1078,7 +1078,7 @@ cli_resume(void * v, struct strbuf *reply, void * data) return 1; udev_flags = (mpp->skip_kpartx)? MPATH_UDEV_NO_KPARTX_FLAG : 0; - if (mpp->wait_for_udev) { + if (mpp->wait_for_udev != UDEV_WAIT_DONE) { condlog(2, "%s: device not fully created, failing resume", mpp->alias); return 1; @@ -1131,7 +1131,7 @@ cli_reassign (void * v, struct strbuf *reply, void * data) if (!mpp) return 1; - if (mpp->wait_for_udev) { + if (mpp->wait_for_udev != UDEV_WAIT_DONE) { condlog(2, "%s: device not fully created, failing reassign", mpp->alias); return 1; @@ -1406,7 +1406,7 @@ static int cli_set_marginal(void * v, struct strbuf *reply, void * data) condlog(2, "%s: set marginal path %s (operator)", pp->mpp->alias, pp->dev_t); - if (pp->mpp->wait_for_udev) { + if (pp->mpp->wait_for_udev != UDEV_WAIT_DONE) { condlog(2, "%s: device not fully created, failing set marginal", pp->mpp->alias); return 1; @@ -1433,7 +1433,7 @@ static int cli_unset_marginal(void * v, struct strbuf *reply, void * data) condlog(2, "%s: unset marginal path %s (operator)", pp->mpp->alias, pp->dev_t); - if (pp->mpp->wait_for_udev) { + if (pp->mpp->wait_for_udev != UDEV_WAIT_DONE) { condlog(2, "%s: device not fully created, " "failing unset marginal", pp->mpp->alias); return 1; @@ -1461,7 +1461,7 @@ static int cli_unset_all_marginal(void * v, struct strbuf *reply, void * data) if (!mpp) return -ENODEV; - if (mpp->wait_for_udev) { + if (mpp->wait_for_udev != UDEV_WAIT_DONE) { condlog(2, "%s: device not fully created, " "failing unset all marginal", mpp->alias); return 1; diff --git a/multipathd/main.c b/multipathd/main.c index 4e26861d..3b4e61fc 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -331,7 +331,7 @@ static bool unblock_reconfigure(void) */ void remove_map_callback(struct multipath *mpp) { - if (mpp->wait_for_udev > 0) + if (mpp->wait_for_udev != UDEV_WAIT_DONE) unblock_reconfigure(); } @@ -871,7 +871,7 @@ ev_add_map (char * dev, const char * alias, struct vectors * vecs) mpp = find_mp_by_alias(vecs->mpvec, alias); if (mpp) { - if (mpp->wait_for_udev > 1) { + if (mpp->wait_for_udev == UDEV_WAIT_RELOAD) { condlog(2, "%s: performing delayed actions", mpp->alias); if (update_map(mpp, vecs, 0)) @@ -882,8 +882,8 @@ ev_add_map (char * dev, const char * alias, struct vectors * vecs) reassign_maps = conf->reassign_maps; put_multipath_config(conf); dm_get_info(mpp->alias, &mpp->dmi); - if (mpp->wait_for_udev) { - mpp->wait_for_udev = 0; + if (mpp->wait_for_udev != UDEV_WAIT_DONE) { + mpp->wait_for_udev = UDEV_WAIT_DONE; if (!need_to_delay_reconfig(vecs) && unblock_reconfigure()) return 0; @@ -1241,7 +1241,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) } if (mpp) trigger_path_udev_change(pp, true); - if (mpp && mpp->wait_for_udev && + if (mpp && mpp->wait_for_udev != UDEV_WAIT_DONE && (pathcount(mpp, PATH_UP) > 0 || (pathcount(mpp, PATH_GHOST) > 0 && path_get_tpgs(pp) != TPGS_IMPLICIT && @@ -1249,7 +1249,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) /* if wait_for_udev is set and valid paths exist */ condlog(3, "%s: delaying path addition until %s is fully initialized", pp->dev, mpp->alias); - mpp->wait_for_udev = 2; + mpp->wait_for_udev = UDEV_WAIT_RELOAD; orphan_path(pp, "waiting for create to complete"); return 0; } @@ -1433,8 +1433,8 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) flush_map_nopaths(mpp, vecs)) goto out; - if (mpp->wait_for_udev) { - mpp->wait_for_udev = 2; + if (mpp->wait_for_udev != UDEV_WAIT_DONE) { + mpp->wait_for_udev = UDEV_WAIT_RELOAD; retval = REMOVE_PATH_DELAY; goto out; } @@ -1646,8 +1646,8 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) if (needs_ro_update(mpp, ro)) { condlog(2, "%s: update path write_protect to '%d' (uevent)", uev->kernel, ro); - if (mpp->wait_for_udev) - mpp->wait_for_udev = 2; + if (mpp->wait_for_udev != UDEV_WAIT_DONE) + mpp->wait_for_udev = UDEV_WAIT_RELOAD; else { if (ro == 1) pp->mpp->force_readonly = 1; @@ -1661,7 +1661,7 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) } } if (auto_resize != AUTO_RESIZE_NEVER && mpp && - !mpp->wait_for_udev) { + mpp->wait_for_udev == UDEV_WAIT_DONE) { struct pathgroup *pgp; struct path *pp2; unsigned int i, j; @@ -2018,13 +2018,13 @@ followover_should_failback(struct multipath *mpp) static bool missing_uev_wait_tick(struct multipath *mpp, bool *timed_out) { - if (mpp->wait_for_udev && --mpp->uev_wait_tick <= 0) { - int wait = mpp->wait_for_udev; + if (mpp->wait_for_udev != UDEV_WAIT_DONE && --mpp->uev_wait_tick <= 0) { + enum udev_wait_states wait = mpp->wait_for_udev; - mpp->wait_for_udev = 0; + mpp->wait_for_udev = UDEV_WAIT_DONE; *timed_out = true; condlog(0, "%s: timeout waiting on creation uevent. enabling reloads", mpp->alias); - return wait > 1; + return wait == UDEV_WAIT_RELOAD; } return false; } @@ -2635,7 +2635,8 @@ static bool update_mpp_prio(struct multipath *mpp) enum prio_update_type prio_update = mpp->prio_update; mpp->prio_update = PRIO_UPDATE_NONE; - if (mpp->wait_for_udev || prio_update == PRIO_UPDATE_NONE) + if (mpp->wait_for_udev != UDEV_WAIT_DONE || + prio_update == PRIO_UPDATE_NONE) return false; condlog(4, "prio refresh"); @@ -3246,7 +3247,7 @@ need_to_delay_reconfig(struct vectors * vecs) return 0; vector_foreach_slot(vecs->mpvec, mpp, i) { - if (mpp->wait_for_udev) + if (mpp->wait_for_udev != UDEV_WAIT_DONE) return 1; } return 0; From patchwork Thu Jan 23 03:16:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13947906 X-Patchwork-Delegate: bmarzins@redhat.com 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id B1EDD35963 for ; Thu, 23 Jan 2025 03:16:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602211; cv=none; b=BY8NeVv+LkcypOVYQQV6/qcMrmCTDQhYOqyMMzh7c9mAf3ZorYGhWdNETx5qIyKXzLcoZJogjKbzzxUogHbvmY1XK+ZKRWSr37TIQp8xui+uHDk3QWVz77ZLtB6n5amCaOVe2MmNcZhARqoJ0xlL3ZmcjWuGUt9qRlOf0BSKUv0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602211; c=relaxed/simple; bh=5wsTzgrii5nPXcwvEHkt1iSU8K3gZLhtiS8pY+ELa5Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=lmEdNlrc+LSujZZHwoIibwEgwDGNKVNzMQ0ACuWPqeHgmvrYPwvx8phAGpyRVm4TZ4ePalWerJVD2yNPhbLhMZsGbvOtCUBZQbFMazMbpaLYlqJk8IdStMzSuUhI10V5nWlzFuDJ/mGXdiWu7EUM+46qOOcrxicBRHCW0usW++c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=DtrL4jp0; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DtrL4jp0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737602208; h=from:from: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; bh=YJ81YFNVV8QsxOxNGSW3+GXNWvM0bXoYPSqxTZVjVY0=; b=DtrL4jp0xaRDu6iJwtv8PFaez2pBBPp0gDLeIdkIw3TCA0vFa9o4B4K1ys9jsPoOCRYxMk /kXMtGouxiP4iW0D9tHe1P+VrhlNRuJkrPdANBoKCUqhVo11n8pE6CeSUDc4OjYvTycBae 2Iqmuf3uYsckgPDuSPOQlIHMndLVS7Y= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-80-u3ORVEYJPmKl4j-GVYA7jA-1; Wed, 22 Jan 2025 22:16:46 -0500 X-MC-Unique: u3ORVEYJPmKl4j-GVYA7jA-1 X-Mimecast-MFC-AGG-ID: u3ORVEYJPmKl4j-GVYA7jA Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A39AA1956087; Thu, 23 Jan 2025 03:16:45 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6DEEC19560B7; Thu, 23 Jan 2025 03:16:45 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 50N3GiHK3017921 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 22:16:44 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 50N3Gih33017920; Wed, 22 Jan 2025 22:16:44 -0500 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 02/13] multipathd: don't reload the map when waiting for udev Date: Wed, 22 Jan 2025 22:16:32 -0500 Message-ID: <20250123031643.3017891-3-bmarzins@redhat.com> In-Reply-To: <20250123031643.3017891-1-bmarzins@redhat.com> References: <20250123031643.3017891-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 0DNfyaiQx4zzeJmqNpwAopSbIyvTbGRqFEbMmQ0eUTA_1737602205 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true In checker_finished(), if we are still waiting for the initial uevent, we should instead set wait_for_udev to UDEV_WAIT_RELOAD, so that we trigger a reload when we get the uevent. Signed-off-by: Benjamin Marzinski --- multipathd/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index 3b4e61fc..b4a366ea 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2978,7 +2978,10 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) continue; } } else if (prio_reload || failback_reload || ghost_reload || inconsistent) { - if (reload_and_sync_map(mpp, vecs) == 2) { + if (mpp->wait_for_udev != UDEV_WAIT_DONE) { + mpp->need_reload = false; + mpp->wait_for_udev = UDEV_WAIT_RELOAD; + } else if (reload_and_sync_map(mpp, vecs) == 2) { /* multipath device deleted */ i--; continue; From patchwork Thu Jan 23 03:16:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13947905 X-Patchwork-Delegate: bmarzins@redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B081635280 for ; Thu, 23 Jan 2025 03:16:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602211; cv=none; b=dvnQvkvmp+h3V3beD6b2d1C7ebgG1cIhT2q4Ff4Po335NfswTIDAtiTg5fbfapsz1PhOIOrSRcCDHYBx5oVqS5635lNISqXWmLU17aNkEmKYeZfYsiqM62pNadptmbOr0hTrikR7HKOqjdUtWQ3VP1ELZgkvA1qbXfflBgeUgNI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602211; c=relaxed/simple; bh=rkZ/BYHISR+HGDNhMmwj9q+g+lTE2MrWV5BG8D6qPiM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=JGpYroOLXOlJl9L3nBhbwyFiZ1uddML4zgKL+KbjJT2rY6PBPmycxMwFUc1epV7dgYv8E5QQXbZaxRwKjITSwosQuC+S1vkOg8yrzDctqwL5gu+M8NJ92hN7fjhzF1+JJtvb8oO9Cg/+dMF/YfVC1LrXrLZ21i/gdhKWSTZW+eA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fbPVJwdP; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fbPVJwdP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737602208; h=from:from: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; bh=p0+yrX459dKjJmcMrvXtaJHzn0Ztk3DGYZxYhdyfub8=; b=fbPVJwdP9UpsqpVamTCMlfik0BNbJRkkvgATWvoORNxIfHiCzqbVuLTZj5mafkrawpHoXN 2VDHqihRmKCW8z9knTK3OnXzAdoMORrZbUnyI10/VUe7lR4jcXomsjlitiigZhdEDIouoR LjWbZxs7XNINO8Fgj33A3hFnYP+HL4Y= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-191-X1El_7TPNO20k_CfbGYI8w-1; Wed, 22 Jan 2025 22:16:46 -0500 X-MC-Unique: X1El_7TPNO20k_CfbGYI8w-1 X-Mimecast-MFC-AGG-ID: X1El_7TPNO20k_CfbGYI8w Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E95B319560B0; Thu, 23 Jan 2025 03:16:45 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8183230001BE; Thu, 23 Jan 2025 03:16:45 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 50N3GiqM3017925 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 22:16:44 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 50N3GiEE3017924; Wed, 22 Jan 2025 22:16:44 -0500 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 03/13] libmultipath: don't set need_reload in adopt_paths Date: Wed, 22 Jan 2025 22:16:33 -0500 Message-ID: <20250123031643.3017891-4-bmarzins@redhat.com> In-Reply-To: <20250123031643.3017891-1-bmarzins@redhat.com> References: <20250123031643.3017891-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: TRcMJRlgwLN_obwnO66LKnVlzVZMZzh8r7Guoxc98rQ_1737602206 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true adopt_paths() is generally called when you are planning on creating or reloading a multipath device. The only time when adopt_paths() is called and mpp->action isn't explicitly set to ACT_CREATE or ACT_RELOAD afterwards is when it is called by coalesce_paths() -> add_map_with_path(). But in this case, you will only set need_reload if the path that is being adopted isn't already part of the device. Because of that, the new device that's being assembled in coalesce_paths() must be different from the existing device (it has a path that isn't in the existing device), so select_action() will select ACT_RELOAD, regardless of the need_reload state. This makes intuitive sense. When multipath adopts a new path, it should reload the device to actually add that path to the device. Signed-off-by: Benjamin Marzinski --- libmultipath/structs_vec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index f5860499..47fc7cf3 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -349,7 +349,7 @@ int adopt_paths(vector pathvec, struct multipath *mpp, */ if (!current_mpp || !mp_find_path_by_devt(current_mpp, pp->dev_t)) - mpp->need_reload = set_path_max_sectors_kb(pp, mpp->max_sectors_kb) || mpp->need_reload; + set_path_max_sectors_kb(pp, mpp->max_sectors_kb); } pp->mpp = mpp; From patchwork Thu Jan 23 03:16:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13947913 X-Patchwork-Delegate: bmarzins@redhat.com 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id C9FD45733A for ; Thu, 23 Jan 2025 03:16:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602213; cv=none; b=KZYcyCXhhtlGs5umOkI5dWYlhvLcqYqKzpM7GPyskoajaSP/HfpW1FzhQWufz6DwMO2AVtuupKWiyiPK6iwwcDAehRaxidiJPJbDfBEM5Gcp+ivPMF6+uRxbvaIXLiNVCbttDzVk2nFu8u/oeDfAIcNe6dBASlSfOf5xQxaBYKs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602213; c=relaxed/simple; bh=DtOQp8lbHaiOs2aQgiJY3FaVzy8SzLNrug2kzA/DZzs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=M9cT1wjYtBVHc+0+mhSIAq6Uui+Z5QzaiZz/pfsHE7NjUUkvmsTDAa8GbdYz6WuW4X6zo5+jMun0sX/SLNXc5OP83/GqUhNFn9lu1eu3iFbEhNn3B9zersKKpRN0HQwmJ9Y1Fa6ChGabpgg5XLlTzoJ10VCYCiW46kRHZJLqAdM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=MB6Yc0bm; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MB6Yc0bm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737602210; h=from:from: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; bh=uchQPncU+MOF7MC1n8kGv+sc3MFY8QJNUQ7ou2Us2Ww=; b=MB6Yc0bmdWDYjauE4zvazAb3voa6jWfrRpUqNoGNzncmutSA016LtgNhySMsRmjQw3+3DL yfRTernQiRaeHYiuFlqJxutVAjn19+D7WLqGuycIJGpKmlBUNdlaExRV6I8yQxFZvVpURF KqwA92Vnk+NpMgMUE6dNx3P0La/F5Ls= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-524-X_kHRWK7Os27J5DNuhXLOA-1; Wed, 22 Jan 2025 22:16:47 -0500 X-MC-Unique: X_kHRWK7Os27J5DNuhXLOA-1 X-Mimecast-MFC-AGG-ID: X_kHRWK7Os27J5DNuhXLOA Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1D07F19560B4; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C6621195608E; Thu, 23 Jan 2025 03:16:45 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 50N3Gisx3017929 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 22:16:44 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 50N3Gilt3017928; Wed, 22 Jan 2025 22:16:44 -0500 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 04/13] libmultipath: remove need_reload check from select_action Date: Wed, 22 Jan 2025 22:16:34 -0500 Message-ID: <20250123031643.3017891-5-bmarzins@redhat.com> In-Reply-To: <20250123031643.3017891-1-bmarzins@redhat.com> References: <20250123031643.3017891-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: LHZJoCDfuEV8Qw8pulH73keCQjhzReUVhjKX6zv4uMU_1737602206 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true select_action() is only called by coalesce_paths() to determine what action to take. The only function that sets mpp->need_reload is update_pathvec_from_dm() and it only sets need_reload if there is a problem with the current device layout. If coalesce_paths() generates the same device layout for the new device, then forcing a reload will not make any difference, since nothing will change. If it generates a different device layout, then it will reload the device regardless of the need_reload value. Signed-off-by: Benjamin Marzinski --- libmultipath/configure.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 534ca7f4..ac5e6713 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -686,8 +686,6 @@ void select_action (struct multipath *mpp, const struct vector_s *curmp, mpp->action = ACT_NOTHING; cmpp = find_mp_by_wwid(curmp, mpp->wwid); cmpp_by_name = find_mp_by_alias(curmp, mpp->alias); - if (mpp->need_reload || (cmpp && cmpp->need_reload)) - force_reload = 1; if (!cmpp) { if (cmpp_by_name) { From patchwork Thu Jan 23 03:16:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13947908 X-Patchwork-Delegate: bmarzins@redhat.com 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CA103A8D0 for ; Thu, 23 Jan 2025 03:16:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602212; cv=none; b=IV5IdCiPvj6sF4HnvO0YXzRuAzRuF7TYKk/IFsac7KosWBTrDJ3l+Ze8ydhS2VYyVqN/M19uVMa7PnLyZw8OwQ9DXY6MxXzjqOeHU+lj7Sq6cy/L+wCC21Qs3Bl2FafrpDruhsVYOkxEpH/aTjuhANpVNLEmAEsXSyAXY4NQfsI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602212; c=relaxed/simple; bh=wLuUUGweED3aQcu91LCZIUUed96Hqf73mdIBR5Cny4g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=DdX6NapFsHvHhobxiutugsKR+a8eQadUrkG1E/9AS4t2p754i/u7fDUYRz0n7TXSke1sXZmxn1f9D3GbadGD68fRju5pAahtlHTd9XlYRYfnPuEjJPGJrEWUxgj6lIGQr1UnXKepDo/HFxPxS4e15t3qVVsxg9WAE2ipTprLjN4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=WjZaIecg; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WjZaIecg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737602209; h=from:from: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; bh=qya/ih2k4Vv1DdYOWb0Qb1ejGIkh9PAuRxY85f//hE0=; b=WjZaIecgl/mmlm5F3tOorzAaMMK4llOuAbrGLIX9wTOM+7buSAWrCm/Y4p3+lJI41XVWV5 fwnjlAVTuMqBg6fNZUVbh8vu3bDlrZP6RSBKQLf3RnxIZsmh2Md6EFq6WZYaGuiVAq1ljU o4PBJ96iwlcZg4ANN3kDEZbaETHspeY= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-102-j5iujsIGMAOfod-CZUWa2w-1; Wed, 22 Jan 2025 22:16:47 -0500 X-MC-Unique: j5iujsIGMAOfod-CZUWa2w-1 X-Mimecast-MFC-AGG-ID: j5iujsIGMAOfod-CZUWa2w Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 286C91956048; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DD8E93003E7F; Thu, 23 Jan 2025 03:16:45 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 50N3GiMF3017933 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 22:16:44 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 50N3GiOi3017932; Wed, 22 Jan 2025 22:16:44 -0500 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 05/13] libmultipath: drop return value from update_pathvec_from_dm Date: Wed, 22 Jan 2025 22:16:35 -0500 Message-ID: <20250123031643.3017891-6-bmarzins@redhat.com> In-Reply-To: <20250123031643.3017891-1-bmarzins@redhat.com> References: <20250123031643.3017891-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 3TcB_M0vFfIgXnyb1zDvejZM2Y_UN_-oMIjoaeVLO9k_1737602206 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true We finally came up with a solution for handling mpp->need_reload, and it doesn't involve checking the return value of update_pathvec_from_dm(), so drop it. Signed-off-by: Benjamin Marzinski --- libmultipath/structs_vec.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 47fc7cf3..b2bb47c3 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -92,14 +92,12 @@ static bool guess_mpp_wwid(struct multipath *mpp) * multipath maps but haven't been discovered. Check whether they * need to be added to pathvec or discarded. * - * Returns: true if immediate map reload is desirable - * * Side effects: * - may delete non-existing paths and empty pathgroups from mpp * - may set pp->wwid and / or mpp->wwid * - calls pathinfo() on existing paths is pathinfo_flags is not 0 */ -static bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp, +static void update_pathvec_from_dm(vector pathvec, struct multipath *mpp, int pathinfo_flags) { int i, j; @@ -111,7 +109,7 @@ static bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp, bool pg_deleted = false; if (!mpp->pg) - return false; + return; /* * This will initialize mpp->wwid with an educated guess, @@ -253,7 +251,6 @@ static bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp, pg_deleted = true; } mpp->need_reload = mpp->need_reload || must_reload; - return must_reload; } static bool set_path_max_sectors_kb(const struct path *pp, int max_sectors_kb) @@ -505,7 +502,6 @@ update_multipath_table__ (struct multipath *mpp, vector pathvec, int flags, if (disassemble_status(status, mpp)) condlog(2, "%s: cannot disassemble status", mpp->alias); - /* FIXME: we should deal with the return value here */ update_pathvec_from_dm(pathvec, mpp, flags); return DMP_OK; From patchwork Thu Jan 23 03:16:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13947918 X-Patchwork-Delegate: bmarzins@redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0F035FEE6 for ; Thu, 23 Jan 2025 03:16:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602214; cv=none; b=rZyo9Q0QNIpl7yBwmhcS2Doj58XrSz+/Xzu37582OM274kQTZvhPUb7E/5dukMi/eTMOgK+Ki1J/O6uUFWwr72C7PJXJpve3lb6FvSp0f/Rb3xXc8V6SX1Mh6FHhDVqimNXAtMOKK2xaFDi1SkQfLJ8063dZ0IElwfVR7++kLQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602214; c=relaxed/simple; bh=ECGJCFCb1HuhkHVze3We4qJr6VYwLep+Kx35J3kbg0s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=ecq+T3FVDCmGOIxg7oOg6C1KYrDJogGKjD/OoNPtUVg7j3ih88bV5ww4bIDT0LoN7WZ+qFiXov1DEzV04icdWkxpB8CueW/icZ9ljGSlmhVKPiw1EcIIsjQYYSqzdCTV6ppIshcPTRid9LoH0TuaZufEMFszFE3HSza7vl0wzko= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=QMFFcUMd; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QMFFcUMd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737602210; h=from:from: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; bh=tlyr+kGHhIc4M8ohRcVGhYUHgpZ88VesAOdaHdUYbTA=; b=QMFFcUMdBWlGu/9MK89GcaqpQsdgxuqdo1p5+fsdEv7nhhYwhIEoedu1HS2VEe4TFYboyr bEaMVtQ3DB3O7MouWErtrc5i9jGb1mFSH4iTkzMCO87cuswgdDdN26EUiottMD7/MqGgkd QvkC4FE3zsv3LW8oQt8y73oiE8j9kLU= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-479-C9EpCWymO_KDa-OCv6DGrg-1; Wed, 22 Jan 2025 22:16:47 -0500 X-MC-Unique: C9EpCWymO_KDa-OCv6DGrg-1 X-Mimecast-MFC-AGG-ID: C9EpCWymO_KDa-OCv6DGrg Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7716319560B0; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 045B8195608A; Thu, 23 Jan 2025 03:16:45 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 50N3Gi5M3017937 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 22:16:44 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 50N3GiKr3017936; Wed, 22 Jan 2025 22:16:44 -0500 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 06/13] libmultipath: Dont scan pointless sysfs parents Date: Wed, 22 Jan 2025 22:16:36 -0500 Message-ID: <20250123031643.3017891-7-bmarzins@redhat.com> In-Reply-To: <20250123031643.3017891-1-bmarzins@redhat.com> References: <20250123031643.3017891-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: xMRR7e6Vp_AkoIaA6XDCBxZOtQJq_E8dPG_A0JDxUyY_1737602206 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true In scsi_sysfs_pathinfo() we should just look for the parent that we want, instead of checking all the parents. Signed-off-by: Benjamin Marzinski --- libmultipath/discovery.c | 27 ++++++++++----------------- tests/test-lib.c | 1 - 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index cc4efbfc..3d4da127 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1527,23 +1527,16 @@ scsi_sysfs_pathinfo (struct path *pp, const struct vector_s *hwtable) const char *attr_path = NULL; static const char unknown[] = "UNKNOWN"; - parent = pp->udev; - while (parent) { - const char *subsys = udev_device_get_subsystem(parent); - if (subsys && !strncmp(subsys, "scsi", 4)) { - attr_path = udev_device_get_sysname(parent); - if (!attr_path) - break; - if (sscanf(attr_path, "%i:%i:%i:%" SCNu64, - &pp->sg_id.host_no, - &pp->sg_id.channel, - &pp->sg_id.scsi_id, - &pp->sg_id.lun) == 4) - break; - } - parent = udev_device_get_parent(parent); - } - if (!attr_path || pp->sg_id.host_no == -1) + parent = udev_device_get_parent_with_subsystem_devtype(pp->udev, "scsi", + "scsi_device"); + if (!parent) + return PATHINFO_FAILED; + attr_path = udev_device_get_sysname(parent); + if (!attr_path) + return PATHINFO_FAILED; + if (sscanf(attr_path, "%i:%i:%i:%" SCNu64, + &pp->sg_id.host_no, + &pp->sg_id.channel, &pp->sg_id.scsi_id, &pp->sg_id.lun) != 4) return PATHINFO_FAILED; if (sysfs_get_vendor(parent, pp->vendor_id, SCSI_VENDOR_SIZE) <= 0) { diff --git a/tests/test-lib.c b/tests/test-lib.c index 99becccd..bb1d8cdd 100644 --- a/tests/test-lib.c +++ b/tests/test-lib.c @@ -282,7 +282,6 @@ struct mocked_path *mocked_path_from_path(struct mocked_path *mp, static const char hbtl[] = "4:0:3:1"; static void mock_sysfs_pathinfo(const struct mocked_path *mp) { - will_return(__wrap_udev_device_get_subsystem, "scsi"); will_return(__wrap_udev_device_get_sysname, hbtl); will_return(__wrap_udev_device_get_sysname, hbtl); will_return(__wrap_udev_device_get_sysattr_value, mp->vendor); From patchwork Thu Jan 23 03:16:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13947914 X-Patchwork-Delegate: bmarzins@redhat.com 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DB5D762F7 for ; Thu, 23 Jan 2025 03:16:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602213; cv=none; b=T4vCDaHQaiCZqcvKS0WH2i5hLClMMJehKfPvydxS7e2kw82SSLXh1MQeZCPtHy73oigTHccB+Hf1EG0PSii+jJfyDXcdiVZseczWNeHrqvooZZYznvKLoowmuvX3Esapkki3Va3NFG8wxTVxsA5RjhVzDrlnqBDhcfhziwRv09A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602213; c=relaxed/simple; bh=JieXzLm+BlpC+So8WzlXUmVw0gl6GT7xrdg3QaWvUjQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=a1bs0JwMavy2wHmt/DLygT8GeiU+1HfEpKe2o2O9ymMCazB/9Yey+ff8083XziwvZY+C+uMIi26k8yzThqNnaOgE0wqSuS04g/l6CQ04aLfdBY21Qnt2y82eh35zmF2QTCMHGtSjuVWS0LMMAPFPnbDAbcXItq1SS6wFtktsnhk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PR3QZxUO; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PR3QZxUO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737602211; h=from:from: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; bh=dMMcOYSrn5CyDZG+94dzd1AtPJZNI8EJBukFEn5YpDU=; b=PR3QZxUO4v64RBs7o1CWkwhfEWp2j2OjipZJpyd3ePmjBz2NlAZn/4RkySzBgBbwlttzt2 YG++4VxXWM6D8xlsfh3qugw+31kqKRiDaGsd5uXnz46NhXfi3COfuOsQeNxM7m07pH34Jr 7D6WUUzWWE2/MFy3T0gNXddBk9fBKs0= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-124-ttQC-N7pNi-Z6uMIZAJ_qA-1; Wed, 22 Jan 2025 22:16:47 -0500 X-MC-Unique: ttQC-N7pNi-Z6uMIZAJ_qA-1 X-Mimecast-MFC-AGG-ID: ttQC-N7pNi-Z6uMIZAJ_qA Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7565619560A1; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 29A4519560A7; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 50N3GjbN3017941 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 22:16:45 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 50N3GjVi3017940; Wed, 22 Jan 2025 22:16:45 -0500 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 07/13] libmultipath: move sysfs checks out of scsi_ioctl_pathinfo Date: Wed, 22 Jan 2025 22:16:37 -0500 Message-ID: <20250123031643.3017891-8-bmarzins@redhat.com> In-Reply-To: <20250123031643.3017891-1-bmarzins@redhat.com> References: <20250123031643.3017891-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: LnJZ0P01EDAcbuWB8pMf-zfNbhX9QXX6DS2N1Z2w9CM_1737602206 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true There are multiple checks in scsi_ioctl_pathinfo() that only use sysfs. pathinfo() is never called with DI_SERIAL and not DI_SYSFS, so it's safe to move them to scsi_sysfs_pathinfo(). The HCTL checking code is already there, so remove the duplicate, and split the sysfs serial checking from the ioctl serial checking. Signed-off-by: Benjamin Marzinski --- libmultipath/discovery.c | 36 ++++++++---------------------------- tests/test-lib.c | 6 ------ 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 3d4da127..ea10f086 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1581,6 +1581,9 @@ scsi_sysfs_pathinfo (struct path *pp, const struct vector_s *hwtable) condlog(3, "%s: tgt_node_name = %s", pp->dev, pp->tgt_node_name); + if (get_vpd_sysfs(parent, 0x80, pp->serial, SERIAL_SIZE) > 0) + condlog(3, "%s: serial = %s (sysfs)", pp->dev, pp->serial); + return PATHINFO_OK; } @@ -1907,8 +1910,6 @@ sysfs_pathinfo(struct path *pp, const struct vector_s *hwtable) static void scsi_ioctl_pathinfo (struct path * pp, int mask) { - struct udev_device *parent; - const char *attr_path = NULL; int vpd_id; if (!(mask & DI_SERIAL)) @@ -1933,34 +1934,13 @@ scsi_ioctl_pathinfo (struct path * pp, int mask) } } - parent = pp->udev; - while (parent) { - const char *subsys = udev_device_get_subsystem(parent); - if (subsys && !strncmp(subsys, "scsi", 4)) { - attr_path = udev_device_get_sysname(parent); - if (!attr_path) - break; - if (sscanf(attr_path, "%i:%i:%i:%" SCNu64, - &pp->sg_id.host_no, - &pp->sg_id.channel, - &pp->sg_id.scsi_id, - &pp->sg_id.lun) == 4) - break; - } - parent = udev_device_get_parent(parent); - } - if (!attr_path || pp->sg_id.host_no == -1) - return; - - if (get_vpd_sysfs(parent, 0x80, pp->serial, SERIAL_SIZE) <= 0) { - if (get_serial(pp->serial, SERIAL_SIZE, pp->fd)) { + if (pp->serial[0] == '\0') { + if (get_serial(pp->serial, SERIAL_SIZE, pp->fd)) condlog(3, "%s: fail to get serial", pp->dev); - return; - } + else + condlog(3, "%s: serial = %s (ioctl)", pp->dev, + pp->serial); } - - condlog(3, "%s: serial = %s", pp->dev, pp->serial); - return; } static void diff --git a/tests/test-lib.c b/tests/test-lib.c index bb1d8cdd..cb60f10e 100644 --- a/tests/test-lib.c +++ b/tests/test-lib.c @@ -339,12 +339,6 @@ void mock_pathinfo(int mask, const struct mocked_path *mp) if (mp->flags & NEED_FD) will_return(__wrap_udev_device_get_devnode, _mocked_filename); - /* scsi_ioctl_pathinfo() */ - if (mask & DI_SERIAL) { - will_return(__wrap_udev_device_get_subsystem, "scsi"); - will_return(__wrap_udev_device_get_sysname, hbtl); - } - if (mask & DI_WWID) { /* get_udev_uid() */ will_return(__wrap_udev_device_get_property_value, From patchwork Thu Jan 23 03:16:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13947907 X-Patchwork-Delegate: bmarzins@redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFEF135977 for ; Thu, 23 Jan 2025 03:16:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602211; cv=none; b=N+/1BoLN24sKL7wWVM+6/4HI8fUDyFyuPBRSQXlJQDTQ8H24jst/acEZ+IxK8zXX06Oos7nmpM3sN00lO9hMGHaPt0sUajc9Er7J0r55XUWcnoL4rjGdmTgGJD46pIHBq+AQbXoCv3gXEB1nFVb70sRjPxfpzqfZAumjh2n8xcI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602211; c=relaxed/simple; bh=QYFo63OVB/3gfzJh1eIsYBX5BfgjYlbU7uxiAsJBmUU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=EISapCX1KHQ6FCURBfQ+1h7heKCyx3NTj04d0yeCA/Qs19Tkm8YJEBMNCsdHWG8JMBFZloFfJoyXYisMBE7CbRn/MFNh5IxE2UfblEPrDkirMMLMujpBH463HAQei04nQxkZR+NvRvbaXSuO8BGWdJ+LwJME6EiAL7DANiQk6kc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KjnLrSk4; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KjnLrSk4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737602209; h=from:from: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; bh=9DTy1f6JjPieboeFoC984ZJq0d/OdRtVT+y4Hj8ATaw=; b=KjnLrSk41QKjN7Tec3xLlhjF8ax/wm1xMczmiXNjXU6uxWYBpNr2Nyx3liB7sOFeFXr3+j qg6M2cSM243UIHXK6TdxH0ABP64jXyl1P68hOncx2rwb6rEtMg3erNn2N0nt+WPsJEER8n rbjD+fntA2Qt7GiEz8OdNPc5p/fL7H4= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-265-xqg-n_ytOCyw6NYvs4ASfA-1; Wed, 22 Jan 2025 22:16:47 -0500 X-MC-Unique: xqg-n_ytOCyw6NYvs4ASfA-1 X-Mimecast-MFC-AGG-ID: xqg-n_ytOCyw6NYvs4ASfA Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9E4B0195608D; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 67E3A195E3D9; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 50N3GjWn3017945 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 22:16:45 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 50N3GjM63017944; Wed, 22 Jan 2025 22:16:45 -0500 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 08/13] libmultipath: rename DI_SERIAL to DI_IOCTL Date: Wed, 22 Jan 2025 22:16:38 -0500 Message-ID: <20250123031643.3017891-9-bmarzins@redhat.com> In-Reply-To: <20250123031643.3017891-1-bmarzins@redhat.com> References: <20250123031643.3017891-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 1cy889KjrEVv7RplBaXLdY5EldH4HgQRTf-tzSkxLmE_1737602206 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true DI_IOCTL is a much more sensible name for what this flag controls. All the pathinfo functions that run for DI_SERIAL use ioctls. They don't just get the serial info, and the serial info can also be gotten by functions run for DI_SYSFS. Signed-off-by: Benjamin Marzinski --- libmultipath/discovery.c | 6 +++--- libmultipath/discovery.h | 7 +++---- multipath/main.c | 2 +- tests/test-lib.c | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index ea10f086..8a780d69 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1912,7 +1912,7 @@ scsi_ioctl_pathinfo (struct path * pp, int mask) { int vpd_id; - if (!(mask & DI_SERIAL)) + if (!(mask & DI_IOCTL)) return; select_vpd_vendor_id(pp); @@ -2433,13 +2433,13 @@ int pathinfo(struct path *pp, struct config *conf, int mask) goto blank; } - if (mask & DI_SERIAL) + if (mask & DI_IOCTL) get_geometry(pp); if (path_state == PATH_UP && pp->bus == SYSFS_BUS_SCSI) scsi_ioctl_pathinfo(pp, mask); - if (pp->bus == SYSFS_BUS_CCISS && mask & DI_SERIAL) + if (pp->bus == SYSFS_BUS_CCISS && mask & DI_IOCTL) cciss_ioctl_pathinfo(pp); if (mask & DI_CHECKER) { diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h index 1f7a6e20..c4a8dd96 100644 --- a/libmultipath/discovery.h +++ b/libmultipath/discovery.h @@ -67,7 +67,7 @@ void cleanup_udev_device_ptr(void *arg); */ enum discovery_mode { DI_SYSFS__, - DI_SERIAL__, + DI_IOCTL__, DI_CHECKER__, DI_PRIO__, DI_WWID__, @@ -77,7 +77,7 @@ enum discovery_mode { }; #define DI_SYSFS (1 << DI_SYSFS__) -#define DI_SERIAL (1 << DI_SERIAL__) +#define DI_IOCTL (1 << DI_IOCTL__) #define DI_CHECKER (1 << DI_CHECKER__) #define DI_PRIO (1 << DI_PRIO__) #define DI_WWID (1 << DI_WWID__) @@ -85,7 +85,6 @@ enum discovery_mode { #define DI_NOIO (1 << DI_NOIO__) /* Avoid IO on the device */ #define DI_NOFALLBACK (1 << DI_NOFALLBACK__) /* do not allow wwid fallback */ -#define DI_ALL (DI_SYSFS | DI_SERIAL | DI_CHECKER | DI_PRIO | \ - DI_WWID) +#define DI_ALL (DI_SYSFS | DI_IOCTL | DI_CHECKER | DI_PRIO | DI_WWID) #endif /* DISCOVERY_H_INCLUDED */ diff --git a/multipath/main.c b/multipath/main.c index 54d635da..46399350 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -533,7 +533,7 @@ configure (struct config *conf, enum mpath_cmds cmd, if (cmd == CMD_LIST_LONG) /* extended path info '-ll' */ - di_flag |= DI_SYSFS | DI_CHECKER | DI_SERIAL; + di_flag |= DI_SYSFS | DI_CHECKER | DI_IOCTL; else if (cmd == CMD_LIST_SHORT) /* minimum path info '-l' */ di_flag |= DI_SYSFS; diff --git a/tests/test-lib.c b/tests/test-lib.c index cb60f10e..e529711d 100644 --- a/tests/test-lib.c +++ b/tests/test-lib.c @@ -18,7 +18,7 @@ #include "test-lib.h" #include "wrap64.h" -const int default_mask = (DI_SYSFS|DI_BLACKLIST|DI_WWID|DI_CHECKER|DI_PRIO|DI_SERIAL); +const int default_mask = (DI_SYSFS|DI_BLACKLIST|DI_WWID|DI_CHECKER|DI_PRIO|DI_IOCTL); const char default_devnode[] = "sdxTEST"; const char default_wwid[] = "TEST-WWID"; /* default_wwid should be a substring of default_wwid_1! */ From patchwork Thu Jan 23 03:16:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13947916 X-Patchwork-Delegate: bmarzins@redhat.com 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A5FD81741 for ; Thu, 23 Jan 2025 03:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602214; cv=none; b=h6wYTWfeQ+RPDsUxx+vDU+xU0Mz+/BNZCgbJaUPz5mdLcrnmD05Wf60QEMoETG5+4o6soSUmrJTyi045aXzoOQkPeXtIb0njrA5sQ2lHkGn2kPbDX0LViyTwvLoPzJ4t8YuYCcchyH22y5DR1UL/rxCXioaXVgwJCER/ljTVKJA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602214; c=relaxed/simple; bh=11rleTVwmSB1nUPaomHGx29yQ7wWTiq9rkIqu09iZ1U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=KeSmSaZhs1XMx2WiJ+zNO1RDYBYdjr5uQOsAaj/H8Qe+AcsiGFr+pG1on8hGb6kIQag6UGk4ujmfuwLzz2OUBU+lDe0Hy/0xJKSVKGX/VEr9tx4nqXQ3xeHEfqSLsWtKZOFyhYTqyOz4Qlt2OemOKJAUdTEd97LDCyucTxQdMOY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=H//OQ/uM; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="H//OQ/uM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737602211; h=from:from: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; bh=GcytcrqYUjPVae6BucmxX12STAaxmI/kXpiLUb0TKMM=; b=H//OQ/uMjSrBVJuNko9kRIQ3822DKDxM/Ha4lqu+pRMPIMYOzJNyARYIXX9jB/jIXsckYX ur7EgF0vcAm8QBLVJdJ+49wiiVvYWr4stszvLtARMhuENV4y5AaTiTEon4isb7ETJ3MUSc xGQh6M5Tk5v3zGyGHvLL9kekM319Nww= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-526-eMSIkK_cPyOS4bTOi0D7Nw-1; Wed, 22 Jan 2025 22:16:47 -0500 X-MC-Unique: eMSIkK_cPyOS4bTOi0D7Nw-1 X-Mimecast-MFC-AGG-ID: eMSIkK_cPyOS4bTOi0D7Nw Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9D61A19560A3; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 66DA119560B7; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 50N3Gj5U3017949 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 22:16:45 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 50N3GjIK3017948; Wed, 22 Jan 2025 22:16:45 -0500 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 09/13] libmultipath: retry DI_IOCTL functions if they were skipped Date: Wed, 22 Jan 2025 22:16:39 -0500 Message-ID: <20250123031643.3017891-10-bmarzins@redhat.com> In-Reply-To: <20250123031643.3017891-1-bmarzins@redhat.com> References: <20250123031643.3017891-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: -pZNQhJgGxc211967R_fTQ_B_txm0ZxyS7HUDB4OR28_1737602206 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true pathinfo() shouldn't call any of the DI_IOCTL functions if path_state is not PATH_UP (It only actually checked this for scsi_ioctl_pathinfo). But since pathinfo() is rarely called with the DI_IOCTL flag, this information might never be gathered if a path is added, and pathinfo is first called, while it's offline. Make paths remember if they skipped the DI_IOCTL calls because the path was offline, and try again on future pathinfo() calls that don't set DI_NOIO. Also make dm_setgeometry check all paths, since it's possible that set_geometry() was skipped (in the past, the ioctls would just fail for the offline device, with the same result). Signed-off-by: Benjamin Marzinski --- libmultipath/devmapper.c | 22 ++++++++++++++-------- libmultipath/discovery.c | 24 ++++++++++++------------ libmultipath/structs.h | 7 +++++++ 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 55052cf5..8e632ba8 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -1704,7 +1704,10 @@ int dm_reassign(const char *mapname) int dm_setgeometry(struct multipath *mpp) { struct dm_task __attribute__((cleanup(cleanup_dm_task))) *dmt = NULL; + struct pathgroup *pgp; struct path *pp; + int i, j; + bool found = false; char heads[4], sectors[4]; char cylinders[10], start[32]; int r = 0; @@ -1712,15 +1715,18 @@ int dm_setgeometry(struct multipath *mpp) if (!mpp) return 1; - pp = first_path(mpp); - if (!pp) { - condlog(3, "%s: no path for geometry", mpp->alias); - return 1; + vector_foreach_slot (mpp->pg, pgp, i) { + vector_foreach_slot (pgp->paths, pp, j) { + if (pp->geom.cylinders != 0 && + pp->geom.heads != 0 && + pp->geom.sectors != 0) { + found = true; + break; + } + } } - if (pp->geom.cylinders == 0 || - pp->geom.heads == 0 || - pp->geom.sectors == 0) { - condlog(3, "%s: invalid geometry on %s", mpp->alias, pp->dev); + if (!found) { + condlog(3, "%s: no path with valid geometry", mpp->alias); return 1; } diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 8a780d69..2015a32f 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1908,13 +1908,10 @@ sysfs_pathinfo(struct path *pp, const struct vector_s *hwtable) } static void -scsi_ioctl_pathinfo (struct path * pp, int mask) +scsi_ioctl_pathinfo (struct path * pp) { int vpd_id; - if (!(mask & DI_IOCTL)) - return; - select_vpd_vendor_id(pp); vpd_id = pp->vpd_vendor_id; @@ -2433,14 +2430,17 @@ int pathinfo(struct path *pp, struct config *conf, int mask) goto blank; } - if (mask & DI_IOCTL) - get_geometry(pp); - - if (path_state == PATH_UP && pp->bus == SYSFS_BUS_SCSI) - scsi_ioctl_pathinfo(pp, mask); - - if (pp->bus == SYSFS_BUS_CCISS && mask & DI_IOCTL) - cciss_ioctl_pathinfo(pp); + if (mask & DI_IOCTL || pp->ioctl_info == IOCTL_INFO_SKIPPED) { + if (path_state == PATH_UP) { + get_geometry(pp); + if (pp->bus == SYSFS_BUS_SCSI) + scsi_ioctl_pathinfo(pp); + else if (pp->bus == SYSFS_BUS_CCISS) + cciss_ioctl_pathinfo(pp); + pp->ioctl_info = IOCTL_INFO_COMPLETED; + } else if (pp->ioctl_info == IOCTL_INFO_NOT_REQUESTED) + pp->ioctl_info = IOCTL_INFO_SKIPPED; + } if (mask & DI_CHECKER) { if (path_state == PATH_UP) { diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 1b5a878b..28de9a7f 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -353,6 +353,12 @@ struct hd_geometry { #define GROUP_ID_UNDEF -1 +enum ioctl_info_states { + IOCTL_INFO_NOT_REQUESTED = 0, + IOCTL_INFO_SKIPPED, + IOCTL_INFO_COMPLETED, +}; + struct path { char dev[FILE_NAME_SIZE]; char dev_t[BLK_DEV_SIZE]; @@ -412,6 +418,7 @@ struct path { vector hwe; struct gen_path generic_path; int tpg_id; + enum ioctl_info_states ioctl_info; }; typedef int (pgpolicyfn) (struct multipath *, vector); From patchwork Thu Jan 23 03:16:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13947910 X-Patchwork-Delegate: bmarzins@redhat.com 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C5DE3B2BB for ; Thu, 23 Jan 2025 03:16:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602212; cv=none; b=hMCXQchvn1i5+Yo1fksGEDBB6g+jk9y0ZI4FxmBykTNC8tjasHn9elcptz8WUWy1uWykoKqFLaBGr/hA1EymAPo2+cHeD1gokI6/PpaVMh8uiF0feTHtKg+hqb4QZ5iTkwHR+YVBYOnSFT4ctjqOGP2hBFtpe960rRSH9qs5Tkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602212; c=relaxed/simple; bh=JOi6QPAPDEqBg/hBDi5tf0dXfbQqDLIztg2IN4/cNG0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=pulA2lkS6evTi1FjRHLV6oDhvHpgHMSPQ7f3k9+DLnLimpDWPanlSBXNIrIqeYTBfXn6oNA9SrllbyxPPdbGGBs4/c/q5zO3LrbyU4+PLTlnL3baV0DLagsqGKMV05OyzFZ6R8pfP9syKfJFncLBWJgEzetoJbilBnoLqKzPmII= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Wi1s6BiS; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Wi1s6BiS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737602209; h=from:from: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; bh=9wJsjo89tlt4+Gm3wH/ufjzcnSjaH9eEz2xCHnKAJy0=; b=Wi1s6BiSMzl5owAL8GruAwD+yiI1bsJz6PYh/F3zBgP0TKmSecE3JYS31q6kJlJ+g4y4TG eKTJOy+7ZrWV6IO7QB6mLqjM4mApfynNkcpmgINc/e35dsz3HOOtnIRwwLPmsCe0obZeIq 6pbMSXdMa598qN0ocPDH8QQgVWKTyQs= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-92-E9Y3JCXXOkKIYe6cARzLuw-1; Wed, 22 Jan 2025 22:16:48 -0500 X-MC-Unique: E9Y3JCXXOkKIYe6cARzLuw-1 X-Mimecast-MFC-AGG-ID: E9Y3JCXXOkKIYe6cARzLuw Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D905C195608A; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 984F330001BE; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 50N3GjjO3017953 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 22:16:45 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 50N3GjJc3017952; Wed, 22 Jan 2025 22:16:45 -0500 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 10/13] libmultipath: set need_reload when pp->serial gets set Date: Wed, 22 Jan 2025 22:16:40 -0500 Message-ID: <20250123031643.3017891-11-bmarzins@redhat.com> In-Reply-To: <20250123031643.3017891-1-bmarzins@redhat.com> References: <20250123031643.3017891-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: RHv9SUF-zg4s9lrkmcLylpn2G-2ew4uowiBzoQjocGE_1737602207 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true If a multipath device has a path grouping policy of "group_by_serial" and pp->serial wasn't previously set, set need_reload. If the multipath device hasn't been created yet, need_reload will get cleared when the device is created. If the multipath device already exists, the path likely wasn't in the correct pathgroup, since it was unable to set pp->serial before the paths were grouped. Signed-off-by: Benjamin Marzinski --- libmultipath/discovery.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 2015a32f..48e23d44 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -2317,6 +2317,7 @@ get_uid (struct path * pp, int path_state, struct udev_device *udev, int pathinfo(struct path *pp, struct config *conf, int mask) { int path_state; + bool need_serial_recheck = false; if (!pp || !conf) return PATHINFO_FAILED; @@ -2357,6 +2358,10 @@ int pathinfo(struct path *pp, struct config *conf, int mask) pp->dev) > 0) return PATHINFO_SKIPPED; + if (pp->mpp && pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_serial && + pp->serial[0] == '\0') + need_serial_recheck = true; + condlog(4, "%s: mask = 0x%x", pp->dev, mask); /* @@ -2415,6 +2420,8 @@ int pathinfo(struct path *pp, struct config *conf, int mask) pp->state == PATH_UNCHECKED || pp->state == PATH_WILD) pp->chkrstate = pp->state = path_state; + if (need_serial_recheck && pp->serial[0] != '\0') + pp->mpp->need_reload = true; return PATHINFO_OK; } @@ -2524,6 +2531,8 @@ int pathinfo(struct path *pp, struct config *conf, int mask) if ((mask & DI_ALL) == DI_ALL) pp->initialized = INIT_OK; + if (need_serial_recheck && pp->serial[0] != '\0') + pp->mpp->need_reload = true; return PATHINFO_OK; blank: From patchwork Thu Jan 23 03:16:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13947915 X-Patchwork-Delegate: bmarzins@redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7248A81724 for ; Thu, 23 Jan 2025 03:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602214; cv=none; b=liGMPhSU8VDptsXIyQRnwFLqegVDRk/jcEcGd+GrXRUfW8+RvOJrmdkgmevQIAf/tDOF8yH2MD7ZJhjhqu71rAufTsH050ZFYm4LOYrEtbToCGFmlpCvTFjmW0/+3FKwTHXd2Cr8BMa7UmjjwWQrzTKTWoBu5jEc1hZR3R4tuus= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602214; c=relaxed/simple; bh=ceU1opEGtw494NaLnr7FeMRNBmu/ghzsvVjK4PZQjLM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=nYsOPUxfumDKEsI+d2TGX85OWyVQh6DNst7OkCshPC4uu9GEOopYy87l/xHwKpgbvl7U7xvrF59fB6WWUpzOKSjCSNN4Kgd3YjFX472V0M1w8VWNeSb8FjJOqlmjC1qk0tKkQz7F+/gnBR9oNXHZJZcOMyh0tlbt80TNwniiejQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=eJwWjxgM; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eJwWjxgM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737602211; h=from:from: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; bh=AzMEgoWKHWGmXBcEV6mCQm5i0kPQp2YmMuRYJx+FtaU=; b=eJwWjxgMPttHvn8ieZ4hObgFQUwFrHSJyCtC4ufW0U9TiHCRyq9lJD/jFO5atoztur3r85 viM0OW6eLi90GbfM3sH/yi/kprdKznqIe12Z/fxsbQR8AMIHvUxcdtWKjZ3PwOO/t6FMeL X1Xd3ixuIILYU41WiWvx/6O9WxjlG04= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-479-KAtUFz1CO6qptkHFBeC2aw-1; Wed, 22 Jan 2025 22:16:47 -0500 X-MC-Unique: KAtUFz1CO6qptkHFBeC2aw-1 X-Mimecast-MFC-AGG-ID: KAtUFz1CO6qptkHFBeC2aw Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F1E161955F2D; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BBEDE195608A; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 50N3Gj4V3017957 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 22:16:45 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 50N3GjFW3017956; Wed, 22 Jan 2025 22:16:45 -0500 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 11/13] libmultipath: set need_reload when the tpg_id gets set Date: Wed, 22 Jan 2025 22:16:41 -0500 Message-ID: <20250123031643.3017891-12-bmarzins@redhat.com> In-Reply-To: <20250123031643.3017891-1-bmarzins@redhat.com> References: <20250123031643.3017891-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: e9QBFBDvTUW74Y_vs5yph-DjGXOdPaPFL8chiUQN9Ps_1737602207 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true If a multipath device has a path grouping policy of "group_by_tpg" and pp->tpg_id wasn't previously set, set need_reload. If the multipath device hasn't been created yet, need_reload will get cleared when the device is created. If the multipath device already exists, the path likely wasn't in the correct pathgroup, since it was unable to set pp->tpg_id before the paths were grouped. Signed-off-by: Benjamin Marzinski --- libmultipath/discovery.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 48e23d44..846101d0 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -34,6 +34,7 @@ #include "configure.h" #include "print.h" #include "strbuf.h" +#include "pgpolicies.h" #define VPD_BUFLEN 4096 @@ -1097,8 +1098,13 @@ detect_alua(struct path * pp) int path_get_tpgs(struct path *pp) { - if (pp->tpgs == TPGS_UNDEF) + if (pp->tpgs == TPGS_UNDEF) { detect_alua(pp); + if (pp->tpgs != TPGS_UNDEF && pp->tpg_id != GROUP_ID_UNDEF && + pp->mpp && + pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_tpg) + pp->mpp->need_reload = true; + } return pp->tpgs; } From patchwork Thu Jan 23 03:16:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13947917 X-Patchwork-Delegate: bmarzins@redhat.com 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id DF42285C5E for ; Thu, 23 Jan 2025 03:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602214; cv=none; b=UTcoYQupIWKOxkCLTuCOm8dLJJ+Vy9jQPYXe4G+N0XGCrIcbLgZE9fYlyso2X+nHUv2nTXYAXCjwpu27+dOiNOAmoK1VxQ2Rqi3yo9Mfj3aXRMxHarEEHt6yIKH/GhFvcwuz+NI9WXyMwiANBmdUvZXK8B75eH7ZliafQthvsAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602214; c=relaxed/simple; bh=JeI/yPJ1txW6FJ1GF2e8M48oDSf99leQViZXCXYjxZE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=Qz4cxUDM87A5EQ18yNN+lwv0a6CjbqeQt50B4urWrPPRGLYIxayi2GS6/Z9v2l+CWoJd5QrbcOS6y/HdcvJpub1avTHIS4gG/BT10xWA+79z+RZ4af01xESuhDNCYwA+Q2tJF0WXInJVSJYG4cwpzc72WTLW1IQNWtJeZHhOdw0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=VVZHYPRj; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VVZHYPRj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737602211; h=from:from: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; bh=egoX42DkQVAaucvQA1al166ytXVpomBWuE281NkX3Rg=; b=VVZHYPRjuuOyaNEsoreXrH/qitLZdbXNrjNfaLPKgVIkRuqB8zqXV1QEAP+gcBgZDd8OUl UOoHOtcpVbe/PphuIfbjltPecHuIG5pz2C3Pv+eYYXK/9pCtB1mxuQDbj8R+eJnmrCn6MC O95SamxwYxMzCIo1z6a/cyBOW1syIzY= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-326-jvqaRBDuN4Wj4bjFIIC1bQ-1; Wed, 22 Jan 2025 22:16:48 -0500 X-MC-Unique: jvqaRBDuN4Wj4bjFIIC1bQ-1 X-Mimecast-MFC-AGG-ID: jvqaRBDuN4Wj4bjFIIC1bQ Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 20D3319560AB; Thu, 23 Jan 2025 03:16:47 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C8E7019560AA; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 50N3GjXZ3017961 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 22:16:45 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 50N3GjIb3017960; Wed, 22 Jan 2025 22:16:45 -0500 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 12/13] libmultipath: stop static analyzer complaint in init_foreign Date: Wed, 22 Jan 2025 22:16:42 -0500 Message-ID: <20250123031643.3017891-13-bmarzins@redhat.com> In-Reply-To: <20250123031643.3017891-1-bmarzins@redhat.com> References: <20250123031643.3017891-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: aACkWY4EuWbkoDcP-pauXr3R8tMLsttdUS-bxe6ZCDI_1737602207 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true This change doesn't actually fix anything. The code was already safe. Signed-off-by: Benjamin Marzinski --- libmultipath/foreign.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/foreign.c b/libmultipath/foreign.c index 28d1b115..af5b0ed3 100644 --- a/libmultipath/foreign.c +++ b/libmultipath/foreign.c @@ -129,7 +129,7 @@ static void free_pre(void *arg) static int _init_foreign(const char *enable) { char pathbuf[PATH_MAX]; - struct dirent **di; + struct dirent **di = NULL; struct scandir_result sr; int r, i; regex_t *enable_re = NULL; From patchwork Thu Jan 23 03:16:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13947911 X-Patchwork-Delegate: bmarzins@redhat.com 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EC3F41C63 for ; Thu, 23 Jan 2025 03:16:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602212; cv=none; b=EMtQN8tFbg2T+e79zAcxkLvPFltxNvcL+HKQEmgRCKbROcolms1m9klY7euKlRNB5Rv1I93Bs90sTQ8DxUXHH+77PZ0AwrQfR3yrI//m9HH8oc5+IotDCZZen+KAybstqN+7zFIfmpEn7OpiKkVAMH11drAwY6gQMYosZg1BPBY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737602212; c=relaxed/simple; bh=gplegxwAVdYcMvrGCt3FYj/655l5otjOXSjckBeyE3o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=Mlng2aVyjLtZcv0oTEcNF26HdGpUNu480UxBl43LL6tYMO4Y5Hi6VM1obsVds1xyh8Zv4vNnyFfYS08EN6BI40I7ZJcoXRZy+BYBXtffJ1mU12ZRFP4SqPBWKH9udL+vt2Z/HfaSvcYwLntToGN7BioFvI8BB/+xL+KKm4e3FjA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=TMDV/rPD; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TMDV/rPD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737602209; h=from:from: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; bh=Ds6TvzHfQlQcmX8Z/5WevJKcuYjh6EQuaIbvI8Bi5u0=; b=TMDV/rPDXKa+BbPphBCf3AdYQtTSxe98Jt5lGvdTzgtMgrrBvq3QHNRkkYoD8MuMfR148H X2OBdNAcMMgz/ID83SbMIW/R9PLmwFVMnsEb+DtDbfpuMyrx8UJv3/oip89LIKJkkMUg2K i0eWsscIr05vZxvYcpLxa6OAzyQITBY= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-570-F8Zmz4cCPcqC6T9_7mxS-A-1; Wed, 22 Jan 2025 22:16:48 -0500 X-MC-Unique: F8Zmz4cCPcqC6T9_7mxS-A-1 X-Mimecast-MFC-AGG-ID: F8Zmz4cCPcqC6T9_7mxS-A Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 55C8219560BB; Thu, 23 Jan 2025 03:16:47 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0F579195608A; Thu, 23 Jan 2025 03:16:46 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.1) with ESMTPS id 50N3GjbV3017967 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 22 Jan 2025 22:16:45 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 50N3Gjit3017966; Wed, 22 Jan 2025 22:16:45 -0500 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 13/13] libmultipath: be lenient in allowing the alua-based pgpolicies Date: Wed, 22 Jan 2025 22:16:43 -0500 Message-ID: <20250123031643.3017891-14-bmarzins@redhat.com> In-Reply-To: <20250123031643.3017891-1-bmarzins@redhat.com> References: <20250123031643.3017891-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 3P7c_dAJWATOCvqFWBb8LpJX54z_DSpHb027GDMZb84_1737602207 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true multipath wouldn't autodetect the GROUP_BY_PRIO path grouping policy or allow the GROUP_BY_TPG policy if there was a path that didn't have its prioritizer selected (for instance because multipathd was reconfigured while it was offline). To avoid this, make verify_alua_prio() assume an alua multipath device if all the paths with a prioritizer selected (there must be at least one) use an alua-based prioritizer. Signed-off-by: Benjamin Marzinski --- libmultipath/propsel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c index ad771d35..664e62fc 100644 --- a/libmultipath/propsel.c +++ b/libmultipath/propsel.c @@ -255,14 +255,18 @@ verify_alua_prio(struct multipath *mp) { int i; struct path *pp; + bool assume_alua = false; vector_foreach_slot(mp->paths, pp, i) { const char *name = prio_name(&pp->prio); + if (!prio_selected(&pp->prio)) + continue; if (strncmp(name, PRIO_ALUA, PRIO_NAME_LEN) && strncmp(name, PRIO_SYSFS, PRIO_NAME_LEN)) return false; + assume_alua = true; } - return true; + return assume_alua; } int select_detect_pgpolicy(struct config *conf, struct multipath *mp)