From patchwork Fri Feb 2 16:38:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mariusz Tkaczyk X-Patchwork-Id: 13543162 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (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 15139148315 for ; Fri, 2 Feb 2024 16:39:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706891954; cv=none; b=VV12ckRBc5r/kFSYcIbY2RkOkb/kn5kdWG6GAplf5q8kkjrhkQEC23RiioshVk1Dx4Z32rYGiy5jykH6yfUHv8yNo0oSKRDE+Jk47VzneWfjPpSJ1fUxjKrz7O4bv/LQrQEG1GMrRyG1/7+MIZZE4T3rIYLMTdCwnpUeC5Ms08U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706891954; c=relaxed/simple; bh=vuEaeHcOCOc3RSI485IBZwF5cHiYvOoQzII86vWpQDE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BdJXB+xCq9Afl3pMFWWd4h2gXuVR6Fm6Axh18J7zcdjq8pkQvwD2wRQ9NgnunLUf55IJGZMnAI8396xujH09RMBn1ZGDxQt1K4RYzPUvCtiqAdRSzqXytBKY7ofLmYR+ArKyYU33NKH8e4j9JYsyqRkbzUJxecIAXhuynMkQh10= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=GkkEdXqg; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GkkEdXqg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706891954; x=1738427954; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vuEaeHcOCOc3RSI485IBZwF5cHiYvOoQzII86vWpQDE=; b=GkkEdXqgcbVXYue5u508c2Df53sm4NTLAaNG5iI1VpNYEy6I6I4BSiiU lHhzL6RKgyUimHrN73EkSXl1ueLgEX9DAXbof2+xNlLvshxCJHf2UB+Ai Juz2DbgLCT7LHunP+KRNKjYa1vV3HoHgVyrvXmV8vrSCidz6493RmzB2F BDiOXruujQ29Ukzre/VrC52FeC+wFKvAZ9woFZ5sDEfWkuku8fmo+Ynng qO2b0Qh70jFfAd1UIQayY2XY812WIHpE5nGk+pqBqmEQNOv92PpgT2xAS z1SQBJdk4s9VLPo+oPRP/oYE1PDwzdYhTMf+jsNmBI3+UvOB+ZiNpoqM3 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10971"; a="376800" X-IronPort-AV: E=Sophos;i="6.05,238,1701158400"; d="scan'208";a="376800" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2024 08:39:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,238,1701158400"; d="scan'208";a="4723287" Received: from unknown (HELO mtkaczyk-devel.igk.intel.com) ([10.102.108.91]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2024 08:39:12 -0800 From: Mariusz Tkaczyk To: jes@trained-monkey.org Cc: linux-raid@vger.kernel.org, Mariusz Tkaczyk Subject: [PATCH 1/2] Revert "Fix assembling RAID volume by using incremental" Date: Fri, 2 Feb 2024 17:38:34 +0100 Message-Id: <20240202163835.9652-2-mariusz.tkaczyk@linux.intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240202163835.9652-1-mariusz.tkaczyk@linux.intel.com> References: <20240202163835.9652-1-mariusz.tkaczyk@linux.intel.com> Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This reverts commit d8d09c1633b2f06f88633ab960aa02b41a6bdfb6. Signed-off-by: Mariusz Tkaczyk --- Assemble.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Assemble.c b/Assemble.c index 9d042055ad4e..550369ae8403 100644 --- a/Assemble.c +++ b/Assemble.c @@ -1984,10 +1984,12 @@ int assemble_container_content(struct supertype *st, int mdfd, return 1; } - /* Fill sysfs properties only if they are not set. Determine it by checking text_version - * and ignoring special character on the first place. - */ - if (strcmp(sra->text_version + 1, content->text_version + 1) != 0) { + if (strcmp(sra->text_version, content->text_version) != 0) { + if (content->array.major_version == -1 && + content->array.minor_version == -2 && + c->readonly && + content->text_version[0] == '/') + content->text_version[0] = '-'; if (sysfs_set_array(content, 9003) != 0) { sysfs_free(sra); return 1; From patchwork Fri Feb 2 16:38:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mariusz Tkaczyk X-Patchwork-Id: 13543163 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (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 9BE89148303 for ; Fri, 2 Feb 2024 16:39:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706891960; cv=none; b=nwRXOQxIF4Q5ScR1sNVFg3Q5hV2WbFEPkJxKbv6oMLQ8ydiPNkrOdo1/F9te14fbn4Qk1wDubbgPQ+zNnwOkb5iMoKahZJ1ObZprfp7IkUopEl0/q+sLRCAlDl9Y+EH8S60dp9aIF4mzcaqXOnJAcmwZzcqZmxASmw5cR3tRDZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706891960; c=relaxed/simple; bh=xWsJ8IricUmi6yQa/nWBPHNebhVBgmii5uuAT/dDf8c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ub6qHcnXRbIdaW5FqvCG2aIVu45Et5vEJzCKJMBA8zGjaDSfRXgnoBva7KbD0JTvTB+9DsUgVN8mw6B1DISzON+QYPYXh+LIIToWR3i8mHFWKcDnl+2b3hhtinOslrExG1xET6jFCRtuggFXLFi32ZRoEvmYsI4NugDEoIUQdGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Tqp1ROVc; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Tqp1ROVc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706891956; x=1738427956; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xWsJ8IricUmi6yQa/nWBPHNebhVBgmii5uuAT/dDf8c=; b=Tqp1ROVcRvaMAH/zcHWJ7aX7ciF98bGzMOzO3kaKbRpCdR7C7kBzV8Zd 9ttkXoU6tWzSmabFRc+rsaH7km9ZVKe8oIwMfyabQZQJRtj6EyMvoUfn6 RhWWNFlgTTuOi+VPScDNsWA0DI3x4Om4pMCMa3zVbr4wY7mxgB9sKE0fe 7GRqu80K97AMI4obUgRDNd8JGPRBM8JZbAuSIVlfsLn4w5/ncC/vr0khi Hh2VZJWQ9S2Q3NSsPCzdKamV0tEtcqiW5hPKDxdexQOUKQf1pxZb6/mBe bi1bkrgQ5Vpwcj8movYKU1iABmUwjpmhEVKYjulqOp5n9AnCHsSvOpBZU g==; X-IronPort-AV: E=McAfee;i="6600,9927,10971"; a="376818" X-IronPort-AV: E=Sophos;i="6.05,238,1701158400"; d="scan'208";a="376818" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2024 08:39:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,238,1701158400"; d="scan'208";a="4723288" Received: from unknown (HELO mtkaczyk-devel.igk.intel.com) ([10.102.108.91]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2024 08:39:14 -0800 From: Mariusz Tkaczyk To: jes@trained-monkey.org Cc: linux-raid@vger.kernel.org, Mariusz Tkaczyk Subject: [PATCH 2/2] Revert "mdadm: remove container_enough logic" Date: Fri, 2 Feb 2024 17:38:35 +0100 Message-Id: <20240202163835.9652-3-mariusz.tkaczyk@linux.intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240202163835.9652-1-mariusz.tkaczyk@linux.intel.com> References: <20240202163835.9652-1-mariusz.tkaczyk@linux.intel.com> Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This reverts commit 4dde420fc3e24077ab926f79674eaae1b71de10b. Signed-off-by: Mariusz Tkaczyk --- Incremental.c | 11 +++++++++++ mdadm.h | 3 +++ super-ddf.c | 1 + super-intel.c | 32 +++++++++++++++++++++++++++++++- 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/Incremental.c b/Incremental.c index 6cbc164a27b9..5477a5369c6f 100644 --- a/Incremental.c +++ b/Incremental.c @@ -1467,6 +1467,17 @@ static int Incremental_container(struct supertype *st, char *devname, st->ss->getinfo_super(st, &info, NULL); + if ((c->runstop > 0 && info.container_enough >= 0) || + info.container_enough > 0) + /* pass */; + else { + if (c->export) { + printf("MD_STARTED=no\n"); + } else if (c->verbose) + pr_err("not enough devices to start the container\n"); + return 0; + } + match = conf_match(st, &info, devname, c->verbose, &rv); if (match == NULL && rv == 2) return rv; diff --git a/mdadm.h b/mdadm.h index 709b6104c401..0b647085fea1 100644 --- a/mdadm.h +++ b/mdadm.h @@ -377,6 +377,9 @@ struct mdinfo { int container_member; /* for assembling external-metatdata arrays * This is to be used internally by metadata * handler only */ + int container_enough; /* flag external handlers can set to + * indicate that subarrays have not enough (-1), + * enough to start (0), or all expected disks (1) */ char sys_name[32]; struct mdinfo *devs; struct mdinfo *next; diff --git a/super-ddf.c b/super-ddf.c index a87e3169d325..7571e3b740c6 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -1975,6 +1975,7 @@ static void getinfo_super_ddf(struct supertype *st, struct mdinfo *info, char *m info->array.ctime = DECADE + __be32_to_cpu(*cptr); info->array.chunk_size = 0; + info->container_enough = 1; info->disk.major = 0; info->disk.minor = 0; diff --git a/super-intel.c b/super-intel.c index 6a664a2e58d3..697820b0d85e 100644 --- a/super-intel.c +++ b/super-intel.c @@ -3778,6 +3778,7 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char * struct intel_super *super = st->sb; struct imsm_disk *disk; int map_disks = info->array.raid_disks; + int max_enough = -1; int i; struct imsm_super *mpb; @@ -3819,9 +3820,12 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char * for (i = 0; i < mpb->num_raid_devs; i++) { struct imsm_dev *dev = get_imsm_dev(super, i); - int j = 0; + int failed, enough, j, missing = 0; struct imsm_map *map; + __u8 state; + failed = imsm_count_failed(super, dev, MAP_0); + state = imsm_check_degraded(super, dev, failed, MAP_0); map = get_imsm_map(dev, MAP_0); /* any newly missing disks? @@ -3836,10 +3840,36 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char * if (!(ord & IMSM_ORD_REBUILD) && get_imsm_missing(super, idx)) { + missing = 1; break; } } + + if (state == IMSM_T_STATE_FAILED) + enough = -1; + else if (state == IMSM_T_STATE_DEGRADED && + (state != map->map_state || missing)) + enough = 0; + else /* we're normal, or already degraded */ + enough = 1; + if (is_gen_migration(dev) && missing) { + /* during general migration we need all disks + * that process is running on. + * No new missing disk is allowed. + */ + max_enough = -1; + enough = -1; + /* no more checks necessary + */ + break; + } + /* in the missing/failed disk case check to see + * if at least one array is runnable + */ + max_enough = max(max_enough, enough); } + dprintf("enough: %d\n", max_enough); + info->container_enough = max_enough; if (super->disks) { __u32 reserved = imsm_reserved_sectors(super, super->disks);