From patchwork Thu Oct 31 18:32:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13858293 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 A264819D899 for ; Thu, 31 Oct 2024 18:33:08 +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=1730399591; cv=none; b=bYtNOIEs/HiYw5WbWVa+YJJlm3Vy2Oic3+bvekOPMfAFFtursCr6Q6PkEAwsgTYAp5yXvESnG2OrAGo30wsiDw6L0vlPCyT3fZehaVCvAZwb334Tkw7cy6K6EYx9Tjt61QMiuizVN2LR+8EpMWQguMXQ5Wgobz/WBpmJ/qwFmFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730399591; c=relaxed/simple; bh=j7Qyz7/iLN1XaE9OJPSxxm1MiTVn/UCFUOv2kgZMtXM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mJYjIuCXEdSvj9vlqGNlYtg3Pf50Q7Ry0TPN2bYLPo8fHiSYAldxoGdwc7SpVdhs9WnuqpvFT9IjML3BYG1YXhUcQ/H6xrdFOHAbxAc6BzJymHGz79piJHJpCZs1GFarsi3S8g5+AOJ63wGkJIXyVkkwfB/wmAU2q7TyJ872WIQ= 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=CQ/iaQSE; 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="CQ/iaQSE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730399587; 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=sf82NNtDZ2WdthQc+jNpgZOHYllkp6snWIoQ11AMreQ=; b=CQ/iaQSEgxBZWI/0OHe1Pdfvw9R6wcxaVZe4272jSfm4I3NGs6pZfiO5HazhY9c75mFDjc x8b/8LKO5CPbcXcACvbKTD0s9DgTQbSuzmtx2a07KpIQ70Y/gUrcgYbyNU8fGSHvpCIvfZ 6qMNOdMYO8ooWw+Pe4VvD/XqGwyFzf4= 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-529-_pkCaXTxMWWGrLODcxUAjg-1; Thu, 31 Oct 2024 14:33:05 -0400 X-MC-Unique: _pkCaXTxMWWGrLODcxUAjg-1 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 57BFC1955EE6; Thu, 31 Oct 2024 18:33:04 +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 C8086300019D; Thu, 31 Oct 2024 18:33:03 +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 49VIX2k6391437 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 31 Oct 2024 14:33:02 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 49VIX27T391436; Thu, 31 Oct 2024 14:33:02 -0400 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 1/8] multipathd: print an error when failing to connect to multipathd Date: Thu, 31 Oct 2024 14:32:54 -0400 Message-ID: <20241031183301.391416-2-bmarzins@redhat.com> In-Reply-To: <20241031183301.391416-1-bmarzins@redhat.com> References: <20241031183301.391416-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-Originator: redhat.com Issuing multipathd commands when the daemon wasn't running didn't print anything. Signed-off-by: Benjamin Marzinski --- multipathd/uxclnt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/multipathd/uxclnt.c b/multipathd/uxclnt.c index 16133a88..55d253a7 100644 --- a/multipathd/uxclnt.c +++ b/multipathd/uxclnt.c @@ -52,8 +52,10 @@ int uxclnt(char * inbuf, unsigned int timeout) if (!inbuf) return 1; fd = mpath_connect(); - if (fd == -1) + if (fd == -1) { + fprintf(stderr, "ERROR: failed to connect to multipathd\n"); return 1; + } ret = process_req(fd, inbuf, timeout); From patchwork Thu Oct 31 18:32:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13858295 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 D9A4C1BD008 for ; Thu, 31 Oct 2024 18:33:09 +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=1730399592; cv=none; b=GUDYX8P4aUK7M9hxoHiOR3jrGcgw0Q95qjz7mHERzmwGRWrMJy5v8/ORNwYviXmQOFyr8if9yPIntuz4cuKjKVkAZO18X4eKFhDVfzi8Ym5rxIpfciUTrlx/Z/m9+mrl7TFWijULYsXtgyUc9bhKD8MRHrXwR4CcKIpHIasl884= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730399592; c=relaxed/simple; bh=UJKHLprM+8gQV5Ch6nmFQ78NGWazjzDcyOBOU9VkedE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YGlUC2wVvP4vnbYEXOjrX2heRQN6NrIlxWhsIVT2VG1A4WscT5owTDKLofCRsN5CVMtg+yVVd6AHLay9wK0FCL/6juLa4xKVRtvUoRZ3fXNapud/GvHRM6Cx8V55heLnixVxKgm3dRJkGI4QSrYyMxj0kBas6LZ/FYtgiYlsGoA= 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=dvu99SrI; 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="dvu99SrI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730399589; 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=3QjUQDZlr29UX4LD+Rlh5Bcy+6oIhQnoqKVkP/qwYgY=; b=dvu99SrIkQjYZkMPv4XqMlOPiG6XW0oLwav2QWDEXBYq2G+WdNRQ6MyYIe4l74EVourMkb 34pKVVdl2AXUyOKuwqakwO1ZZKEGLiNl3V8lzz+pmbwEqu9K5MjNZi2zhkpUfYHZ/wN8Zn cgOBKZRJ1iNgay1tatRk0/r7T7gqpKA= 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-531-Lm76npz4Mr6UHOJ0s7zENg-1; Thu, 31 Oct 2024 14:33:05 -0400 X-MC-Unique: Lm76npz4Mr6UHOJ0s7zENg-1 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 6AE061955EE7; Thu, 31 Oct 2024 18:33:04 +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 DCBFB19560A2; Thu, 31 Oct 2024 18:33:03 +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 49VIX2TY391441 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 31 Oct 2024 14:33:02 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 49VIX2D7391440; Thu, 31 Oct 2024 14:33:02 -0400 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 2/8] libmultipath: check DM UUID earlier in libmp_mapinfo__ Date: Thu, 31 Oct 2024 14:32:55 -0400 Message-ID: <20241031183301.391416-3-bmarzins@redhat.com> In-Reply-To: <20241031183301.391416-1-bmarzins@redhat.com> References: <20241031183301.391416-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-Originator: redhat.com Before checking the target details, first check that the device has a "mpath-" dm uuid prefix. If it doesn't then we can just ignore the device. This keeps multipath from printing error messages for non-multipath devices with multiple targets for instance. Signed-off-by: Benjamin Marzinski --- libmultipath/devmapper.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index c497c225..41c6ae4d 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -715,6 +715,16 @@ static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *ma return DMP_NOT_FOUND; } + if ((info.name && !(name = dm_task_get_name(dmt))) + || ((info.uuid || flags & MAPINFO_CHECK_UUID) + && !(uuid = dm_task_get_uuid(dmt)))) + return DMP_ERR; + + if (flags & MAPINFO_CHECK_UUID && !is_mpath_uuid(uuid)) { + condlog(3, "%s: UUID mismatch: %s", fname__, uuid); + return DMP_NO_MATCH; + } + if (info.target || info.status || info.size || flags & MAPINFO_TGT_TYPE__) { if (dm_get_next_target(dmt, NULL, &start, &length, &target_type, ¶ms) != NULL) { @@ -740,18 +750,10 @@ static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *ma * Check possible error conditions. * If error is returned, don't touch any output parameters. */ - if ((info.name && !(name = dm_task_get_name(dmt))) - || ((info.uuid || flags & MAPINFO_CHECK_UUID) - && !(uuid = dm_task_get_uuid(dmt))) - || (info.status && !(tmp_status = strdup(params))) + if ((info.status && !(tmp_status = strdup(params))) || (info.target && !tmp_target && !(tmp_target = strdup(params)))) return DMP_ERR; - if (flags & MAPINFO_CHECK_UUID && !is_mpath_uuid(uuid)) { - condlog(3, "%s: UUID mismatch: %s", fname__, uuid); - return DMP_NO_MATCH; - } - if (info.name) { strlcpy(info.name, name, WWID_SIZE); condlog(4, "%s: %s: name: \"%s\"", fname__, map_id, info.name); From patchwork Thu Oct 31 18:32:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13858296 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 E3D361B85C1 for ; Thu, 31 Oct 2024 18:33:09 +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=1730399592; cv=none; b=XlsylIBiTL88tLlTzs2pQW/pXcKtFehXfQBGn6CVHVNRHiJ61+YZuDkOmitoZWyht4BO9ANLjMQzXAq6h2IDAaxPNbsn03tQXwEx57onO5EOhTuiuOpq5U2rz4OjAoioxdzhvMfD61vBu1W/GOnrytd6AurTmGcMJjcANn4tg8E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730399592; c=relaxed/simple; bh=hPSRmMQsP4gqCzJFSirN+h9nNoTTArk52xeJDAsIhc8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oFQHSwheFgOkBOJBNJUtMgWqfpYYCjfs0i+s5KIKdyTUFtz88uoqY4iEV8QH975qV/TnSA01lAre9dnZG/64duwmTuy3ix2TwH2a9HgIYABVinOGjybn7xDB0tdsilPwc1xj4HMK3iK23t5UTtQxnOHNFKAM3WQvNIhHRKURWnY= 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=biIPqYUA; 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="biIPqYUA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730399588; 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=8f+HC8MXwj9bgRGiMLAXIG750/pq/jxT9ClhMMS/Skw=; b=biIPqYUAt+KwCMmQ/J/kMrjT2DeL430HvDfNLN4+r0EGvMmlWgFN7+hqUHTLUscnYM6SLr nJ2x8uJIatKimheloZvXlXTw7FnpBzp03xKMD4+7Kxxv0CqgyY/u6++0WO5omgsxK9bW+R kahPzQOzgjTcW038LBrDfV/eiptq2Cg= 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-452-kL8CmqoUMFqfC3K2luNHZw-1; Thu, 31 Oct 2024 14:33:05 -0400 X-MC-Unique: kL8CmqoUMFqfC3K2luNHZw-1 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6798319560B5; Thu, 31 Oct 2024 18:33:04 +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 120861956054; Thu, 31 Oct 2024 18:33:03 +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 49VIX2AO391445 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 31 Oct 2024 14:33:02 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 49VIX2ke391444; Thu, 31 Oct 2024 14:33:02 -0400 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 3/8] libmultipath: Don't fail dm_get_maps for DMP_NOT_FOUND Date: Thu, 31 Oct 2024 14:32:56 -0400 Message-ID: <20241031183301.391416-4-bmarzins@redhat.com> In-Reply-To: <20241031183301.391416-1-bmarzins@redhat.com> References: <20241031183301.391416-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-Originator: redhat.com DMP_NOT_FOUND is not an error. Signed-off-by: Benjamin Marzinski --- libmultipath/devmapper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 41c6ae4d..33eadb12 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -1265,6 +1265,7 @@ int dm_get_maps(vector mp) vector_set_slot(mp, mpp); break; case DMP_NO_MATCH: + case DMP_NOT_FOUND: break; default: return 1; From patchwork Thu Oct 31 18:32:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13858291 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 EA0B01E495 for ; Thu, 31 Oct 2024 18:33:07 +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=1730399590; cv=none; b=a6Iqz+IXy+F88G1aUnW4pNaAGb0bYKp3IU0h4CsfOJC0HgfxMdMM+zwaTt8KOfjtCySYXuteA8cqK3LbV26ZSMJqs1mTiX3E4bggCoNSC3rCUjAwiSPWAZKDSR0/g+puE22qH12uJnJ4Tov1Uo9oKPfVZt9yRdOCZXZyQ/hN6+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730399590; c=relaxed/simple; bh=hKlGzdIz3wFR08gbArtDpn6fbZ28kn4GkbToHI6GOYU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bOEs2zKw6BA8QplSqUrEEzWZvwk2ekJU+UaLD4zguHjV1vbltIf1Sc2b7GgPO9C8RMoR4g+Qs2JZaSD4RZzX5KV46gN4IhOqEo7Ad8uenl42jSBzq6ifA7qLwhhvVfOXU++cAbtESZgFz7HmF0PQ1Pi/xar1paZ3aE6Esckbjj8= 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=D7h6Q5/F; 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="D7h6Q5/F" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730399586; 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=ILQ5XdlOLXfl82vj2+yJwB0Ise0i5a3LDBczDPNv99k=; b=D7h6Q5/Fhhmdo6rE/mURLqNSiCr5Nj5RJL9GhUhpabpgVGnpwxS546Z4BF4DOnXqBO8WWI DdXJgSnMEWgekSeGEUBOceQk53QPYmyEvWyX47ABXTxJhPXtgcXUL/9YM9by3oXqG+VWzl Qrl73oiqxbjjL/2Iu7pGBP7zkYmVKQA= 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-258-89l8iHlENOG_ANCSihI_Kg-1; Thu, 31 Oct 2024 14:33:05 -0400 X-MC-Unique: 89l8iHlENOG_ANCSihI_Kg-1 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 933A41956096; Thu, 31 Oct 2024 18:33:04 +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 46A24195605A; Thu, 31 Oct 2024 18:33:04 +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 49VIX2Zo391449 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 31 Oct 2024 14:33:02 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 49VIX2Vk391448; Thu, 31 Oct 2024 14:33:02 -0400 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 4/8] multipathd.service: restart multipathd on failure Date: Thu, 31 Oct 2024 14:32:57 -0400 Message-ID: <20241031183301.391416-5-bmarzins@redhat.com> In-Reply-To: <20241031183301.391416-1-bmarzins@redhat.com> References: <20241031183301.391416-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-Originator: redhat.com systemd will now restart multipathd on failure unless it has already been started 3 times in the last 30 seconds. Signed-off-by: Benjamin Marzinski --- multipathd/multipathd.service.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/multipathd/multipathd.service.in b/multipathd/multipathd.service.in index 646001e6..b6a25b31 100644 --- a/multipathd/multipathd.service.in +++ b/multipathd/multipathd.service.in @@ -12,12 +12,15 @@ Conflicts=initrd-cleanup.service ConditionKernelCommandLine=!nompath ConditionKernelCommandLine=!multipath=off ConditionVirtualization=!container +StartLimitIntervalSec=30 +StartLimitBurst=3 [Service] Type=notify NotifyAccess=main ExecStart=@BINDIR@/multipathd -d -s ExecReload=@BINDIR@/multipathd reconfigure +Restart=on-failure TasksMax=infinity LimitRTPRIO=10 CPUWeight=1000 From patchwork Thu Oct 31 18:32:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13858294 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 D99F21BC9F3 for ; Thu, 31 Oct 2024 18:33:09 +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=1730399591; cv=none; b=oHmoEExEByR05gXk4cNoTYzMysxm4SnnAkO4JmJq2Xq6KVWoWaTMha6vEjYI6bguyIs90h9lAlj1LbFGuzZ7gaYL6PfZ5PwGTprk3JVjEIlCsrvfze6bb3veHWOYv/r8swxoK0MbAhGCJV2TeSmC42NopqxSNrcI9ZM88uCDLqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730399591; c=relaxed/simple; bh=XmPCXOUufXoUPP7xiA7xmF7aC1VJfC817kV4WzcvO6w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FgPPd/LaLE8acHQGV9j8vTV2kvKjwOdnE9ielg6BRqUd6G1hr/u8ZnTBCFnrhzb0eSLzEN/fPlBTwQFjFry5YpuyUtD9KW+dZhf7Jt6dcILpgg/rWlU73rV1xvmfTUGlhALdyaJm0t90pZIlIBKUivganCf713eouuszyagZHzY= 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=Y5i//XNn; 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="Y5i//XNn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730399588; 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=656JWP42m/h/xAb32eTHiGPELrL9SBuET0EYHWgbL7c=; b=Y5i//XNnyOTABOrJyKYK3o6sdrgyb1jf0QBQrR2aA4K3pEFVjQcsVJtqPYNrPFh8ZaLFaf QEgkHN1bqwtbyo+3/mSPxnr2K6bE10KJhQIWc9Yo6jjzkFHSKFkF5y56H0HafsRfzBRJKf NRlS7uCLdlQbo4T3SPRgDJxj2bGgod4= 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-629-UORKY0ipPrC4lItjSRT2Uw-1; Thu, 31 Oct 2024 14:33:05 -0400 X-MC-Unique: UORKY0ipPrC4lItjSRT2Uw-1 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 BBD4619560A7; Thu, 31 Oct 2024 18:33:04 +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 7A7851956046; Thu, 31 Oct 2024 18:33:04 +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 49VIX3iY391453 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 31 Oct 2024 14:33:03 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 49VIX3PE391452; Thu, 31 Oct 2024 14:33:03 -0400 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 5/8] libmultipath: use MAPINFO_CHECK_UUID in dm_get_multipath Date: Thu, 31 Oct 2024 14:32:58 -0400 Message-ID: <20241031183301.391416-6-bmarzins@redhat.com> In-Reply-To: <20241031183301.391416-1-bmarzins@redhat.com> References: <20241031183301.391416-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-Originator: redhat.com Instead of seperately calling is_mpath_uuid(), just use MAPINFO_CHECK_UUID when calling libmp_mapinfo. Signed-off-by: Benjamin Marzinski --- libmultipath/devmapper.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 33eadb12..13d8c1e5 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -1211,7 +1211,8 @@ static int dm_get_multipath(const char *name, struct multipath **pmpp) if (!mpp->alias) return DMP_ERR; - if ((rc = libmp_mapinfo(DM_MAP_BY_NAME | MAPINFO_MPATH_ONLY, + if ((rc = libmp_mapinfo(DM_MAP_BY_NAME | MAPINFO_CHECK_UUID | + MAPINFO_MPATH_ONLY, (mapid_t) { .str = name }, (mapinfo_t) { .size = &mpp->size, @@ -1220,9 +1221,6 @@ static int dm_get_multipath(const char *name, struct multipath **pmpp) })) != DMP_OK) return rc; - if (!is_mpath_uuid(uuid)) - return DMP_NO_MATCH; - strlcpy(mpp->wwid, uuid + UUID_PREFIX_LEN, sizeof(mpp->wwid)); *pmpp = steal_ptr(mpp); From patchwork Thu Oct 31 18:32:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13858298 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 C7CE71C9EA4 for ; Thu, 31 Oct 2024 18:33:11 +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=1730399593; cv=none; b=uGIaAy4DwjawugpY1BoorHfz0ZXrGSNqVXkHbX6OGGfN7psmvB0P4NVl8MgWe+WrFvzhfiNsh0OUxmPItDAh/UByCIMZFtDA5ge2wQj8vfLWl6812u6hzdkOcYGZACIof3eHMhRuuI+MNZR3y5fv5GZ+Rv3cRvb39Onq3c9YOMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730399593; c=relaxed/simple; bh=prqdH0rBIyhmZtQ7obmHcCsRaZSiNVWOsG07f/WVn98=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cuOqyntAZv/HswuPQ6b3ucgGDeoHQz/TmPQcoaU2eUKOH64tyGpBtF8APQSaLV7ZP3PC5cItsu8Y0PIgIpkEL54x255oWHPao4mhE0+dlFMJLVVXn3asyPvaixfslAcy304h7uN2hXX7+voreiD1/5R99L1cFbCJgQ/pMnhwq+I= 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=WR6t6FWh; 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="WR6t6FWh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730399591; 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=+R1mMtYdb+8tCMgmDuWHuVAyapTiGe2xtuVW/eeQNIw=; b=WR6t6FWhFmd3cAB3pKjuK/Oi0eubGp+SFFPznpMBATq4ugCJ/C0kgvziyqFtmJev6I1MD4 laawcekisERjQO+LarPIny1JOef0TjIPrgAXLQRScpfRiZ2D5wo+NTrWqhKcXdjDHzAJF5 pd+wk/D4DUB75k1FD1wnArfI5UrsTmk= 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-175-YRhZrxZqO8-qdUpMGkRkCQ-1; Thu, 31 Oct 2024 14:33:05 -0400 X-MC-Unique: YRhZrxZqO8-qdUpMGkRkCQ-1 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 D8FB01955EA5; Thu, 31 Oct 2024 18:33:04 +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 874A21956086; Thu, 31 Oct 2024 18:33:04 +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 49VIX3Dv391458 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 31 Oct 2024 14:33:03 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 49VIX3XO391457; Thu, 31 Oct 2024 14:33:03 -0400 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 6/8] libmultipath: signal multipath UUID device with no table Date: Thu, 31 Oct 2024 14:32:59 -0400 Message-ID: <20241031183301.391416-7-bmarzins@redhat.com> In-Reply-To: <20241031183301.391416-1-bmarzins@redhat.com> References: <20241031183301.391416-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-Originator: redhat.com if libmp_mapinfo() is run on a device that has a multipath prefixed DM UUID but no table (either active or inactive), it will now return with a new exit code, DMP_BAD_DEV, to signal that this is an invalid multipath device. Currently all code paths treat this identically to DMP_NOT_FOUND. Signed-off-by: Benjamin Marzinski --- libmultipath/devmapper.c | 18 ++++++++++++++++++ libmultipath/devmapper.h | 5 ++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 13d8c1e5..6e11d5b5 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -726,6 +726,22 @@ static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *ma } if (info.target || info.status || info.size || flags & MAPINFO_TGT_TYPE__) { + if (!dmi.live_table) { + /* + * If this is device has a multipath uuid but no + * table, flag it, so multipath can clean it up + */ + if (flags & MAPINFO_CHECK_UUID && + !dmi.inactive_table) { + condlog(2, "%s: multipath map %s has no table", + fname__, map_id); + return DMP_BAD_DEV; + } else { + condlog(2, "%s: map %s has no table", fname__, + map_id); + return DMP_NOT_FOUND; + } + } if (dm_get_next_target(dmt, NULL, &start, &length, &target_type, ¶ms) != NULL) { condlog(2, "%s: map %s has multiple targets", fname__, map_id); @@ -869,6 +885,7 @@ int dm_is_mpath(const char *name) return DM_IS_MPATH_YES; case DMP_NOT_FOUND: case DMP_NO_MATCH: + case DMP_BAD_DEV: return DM_IS_MPATH_NO; case DMP_ERR: default: @@ -1262,6 +1279,7 @@ int dm_get_maps(vector mp) } vector_set_slot(mp, mpp); break; + case DMP_BAD_DEV: case DMP_NO_MATCH: case DMP_NOT_FOUND: break; diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h index ba05e0a1..a2dcfb84 100644 --- a/libmultipath/devmapper.h +++ b/libmultipath/devmapper.h @@ -35,6 +35,7 @@ enum { DMP_OK, DMP_NOT_FOUND, DMP_NO_MATCH, + DMP_BAD_DEV, DMP_LAST__, }; @@ -99,7 +100,9 @@ typedef struct libmp_map_info { * @returns: * DMP_OK if successful. * DMP_NOT_FOUND if the map wasn't found, or has no or multiple targets. - * DMP_NO_MATCH if the map didn't match @tgt_type (see above). + * DMP_NO_MATCH if the map didn't match @tgt_type (see above) or didn't + * have a multipath uuid prefix. + * DMP_BAD_DEV if the map has a multipath uuid prefix but no table. * DMP_ERR if some other error occurred. * * This function obtains the requested information for the device-mapper map From patchwork Thu Oct 31 18:33:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13858297 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 AA4D71C9DF7 for ; Thu, 31 Oct 2024 18:33:10 +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=1730399592; cv=none; b=AErt6lNhRExdEsQ2zdZ9v9uRqvxZhXpVUhQQ/2mlwFJqOWvzt8ON68JjzPpjYppyKh/O89BPk8jnmuqDe1XbyFdIfw8RTIfOr2pQ9CC34YsVzsCeK2xQbUQA0FTRb7kn2vylzQlAWyv0aUtJdLRUBbmUcB9pteNCrs7LWKeup3c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730399592; c=relaxed/simple; bh=Fy9HZRyibRSl9H/SPtFrsXDC5dR9qnbRCSOKtibRMhQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FuJ2tQTcGyU3/1k7930Jbri6/4oPvKMYLnwrExw89HqRyOPQy4kAPeowrybW4SUUzkhKt1vXSZgUfkAcH8huotp53AiIN6DjMZv3TyF3166aR4QgXylx02gEuzSQh9hqsoG8suIAvstO9lZY8wmzFH8nEhwdU0Pn5lFtht7OsaI= 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=N5ZyJXb8; 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="N5ZyJXb8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730399589; 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=UPT7BWaZF9TszqQY2FQVFMMuYrn7+9JBNM205dyOofM=; b=N5ZyJXb8CPVqMr5ASr7Zo2qC75olcEwcl8KkUIzJBV86zjI1tXE+8i23dcvR7pEGHJUTSs FN8ABuxrIJJ4zH0h43tRn3yDjYus+90kXkVSGCplgki1sMWOvZPxvoQNb6Bb3Bb2CRY+3L +DE+07mXmryn8PY/wiycRXCsN+npmSo= 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-298-ahVPPZ5mOiqvZMX4Kq891Q-1; Thu, 31 Oct 2024 14:33:06 -0400 X-MC-Unique: ahVPPZ5mOiqvZMX4Kq891Q-1 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 089CA1956048; Thu, 31 Oct 2024 18:33:05 +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 B2B6119560B2; Thu, 31 Oct 2024 18:33:04 +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 49VIX3nU391462 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 31 Oct 2024 14:33:03 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 49VIX365391461; Thu, 31 Oct 2024 14:33:03 -0400 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH 7/8] libmultipath: fix removing device after failed creation Date: Thu, 31 Oct 2024 14:33:00 -0400 Message-ID: <20241031183301.391416-8-bmarzins@redhat.com> In-Reply-To: <20241031183301.391416-1-bmarzins@redhat.com> References: <20241031183301.391416-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-Originator: redhat.com dm_flush_nap_nosync() only removes a device if it has a multipath table. On failed removes, there is no table, so this function does nothing. Instead, if libmp_mapinfo() returns DMP_BAD_DEV, then there is an empty map, and it is removed using dm_device_remove(). Also, since there are no longer any callers of dm_flush_map_nosync(), remove it. Signed-off-by: Benjamin Marzinski --- libmultipath/devmapper.c | 7 +++++-- libmultipath/devmapper.h | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 6e11d5b5..0d1552f5 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -556,9 +556,12 @@ int dm_addmap_create (struct multipath *mpp, char * params) * Failing the second part leaves an empty map. Clean it up. */ err = errno; - if (dm_map_present(mpp->alias)) { + if (libmp_mapinfo(DM_MAP_BY_NAME | MAPINFO_MPATH_ONLY | + MAPINFO_CHECK_UUID, + (mapid_t) { .str = mpp->alias }, + (mapinfo_t) { .uuid = NULL }) == DMP_BAD_DEV) { condlog(3, "%s: failed to load map (a path might be in use)", mpp->alias); - dm_flush_map_nosync(mpp->alias); + dm_device_remove(mpp->alias, 0); } if (err != EROFS) { condlog(3, "%s: failed to load map, error %d", diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h index a2dcfb84..16d6e04f 100644 --- a/libmultipath/devmapper.h +++ b/libmultipath/devmapper.h @@ -166,7 +166,6 @@ enum { int dm_flush_map__ (const char *mapname, int flags, int retries); #define dm_flush_map(mapname) dm_flush_map__(mapname, DMFL_NEED_SYNC, 0) -#define dm_flush_map_nosync(mapname) dm_flush_map__(mapname, DMFL_NONE, 0) #define dm_suspend_and_flush_map(mapname, retries) \ dm_flush_map__(mapname, DMFL_NEED_SYNC|DMFL_SUSPEND, retries) int dm_flush_map_nopaths(const char * mapname, int deferred_remove); From patchwork Thu Oct 31 18:33:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13858299 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 D53B31C9DF7 for ; Thu, 31 Oct 2024 18:33:13 +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=1730399595; cv=none; b=QWBY6NMrOzWmuEu5AOMf4VjYFkgrpSErlPqgDhaQpcRZ9gMgmG7uO06eky123cQv1WClEaONoR8kdrguBdxafYhLUDDrqqAw4dWWADpxNS25XAWwBxJteoZ6/t/p+URlCZ2wC+rvm9EID/ufIeZ/16o9lhcQrQCLE6/Mrsh7Eec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730399595; c=relaxed/simple; bh=E/z/5lcjikMfrXVhTjQuPKEF7Sg1LSS3boVs8n2wn5M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=X7zQHgOKTLjaV8vohAo1WApuHR2sXlxyk5sqdxApQ/ESrsgzQkAij9TvFjk7jRvJEqc1Hg8+Ek9G5LtfQL+yE4iWxL1CFLXc9ApAo1JUaSpBkg/+IofH/Qfom3m/NIKIzVkRj7eBe56ka6LZg6VyhgbWYPf5zo205v3ZsSwXKtA= 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=GZSHC0yT; 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="GZSHC0yT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730399592; 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=t60yKO4fkKQ+3VxZFuPbNvmZUpRG03Qoczri2pGWFnc=; b=GZSHC0yTB95cvZhuj2KtNgtEf1V121pOGIloQgIRZkARxol/rnoTqwIgV4d6bq/cPfCErf l8RWS/ze1aBHvPIXARFT2cMSDqn/A36LPRzZtmXXXhlksXtZ6+lDTE70G03NUz+TIbYtbt l8g5tS5DWYeBkBzKFziQoffKgg/4G+U= 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-225-LFh9LiBeNNqz6-vOSX9FMQ-1; Thu, 31 Oct 2024 14:33:07 -0400 X-MC-Unique: LFh9LiBeNNqz6-vOSX9FMQ-1 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2704819560B2; Thu, 31 Oct 2024 18:33:05 +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 D9B991956088; Thu, 31 Oct 2024 18:33:04 +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 49VIX3uZ391466 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 31 Oct 2024 14:33:03 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.17.2/8.17.2/Submit) id 49VIX3lU391465; Thu, 31 Oct 2024 14:33:03 -0400 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [RFC PATCH 8/8] libmultipath: remove devices with no table and multipath DM UUID Date: Thu, 31 Oct 2024 14:33:01 -0400 Message-ID: <20241031183301.391416-9-bmarzins@redhat.com> In-Reply-To: <20241031183301.391416-1-bmarzins@redhat.com> References: <20241031183301.391416-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-Originator: redhat.com if dm_get_multipath() returns DMP_BAD_DEV in dm_get_maps(), it means that it found an device with a DM UUID prefix of "mpath-" but no table. Treat this as the remains of a failed device creation, and remove it like dm_addmap_create() does when it fails to fully create a device and it's left in this state. Signed-off-by: Benjamin Marzinski --- libmultipath/devmapper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 0d1552f5..908d759c 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -1283,6 +1283,10 @@ int dm_get_maps(vector mp) vector_set_slot(mp, mpp); break; case DMP_BAD_DEV: + condlog(2, "%s: removing empty multipath device", + names->name); + dm_device_remove(names->name, 0); + break; case DMP_NO_MATCH: case DMP_NOT_FOUND: break;