diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-02-21 17:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-02-21 17:13:27 +0000 |
commit | 3fed94e17ad66173547be201605c0014556572e3 (patch) | |
tree | b37177c380fa30d0336aad7cac9c72035523206a | |
parent | Adding upstream version 4.2+20240118. (diff) | |
download | mdadm-3fed94e17ad66173547be201605c0014556572e3.tar.xz mdadm-3fed94e17ad66173547be201605c0014556572e3.zip |
Adding upstream version 4.3.upstream/4.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r-- | Incremental.c | 9 | ||||
-rw-r--r-- | ReadMe.c | 4 | ||||
-rw-r--r-- | config.c | 12 | ||||
-rw-r--r-- | mdadm.8.in | 2 | ||||
-rw-r--r-- | mdadm.conf.5.in | 7 | ||||
-rw-r--r-- | mdadm.h | 7 | ||||
-rw-r--r-- | mdadm.spec | 2 | ||||
-rw-r--r-- | mdmon.8 | 2 | ||||
-rw-r--r-- | super-ddf.c | 1 | ||||
-rw-r--r-- | super-intel.c | 32 | ||||
-rw-r--r-- | super1.c | 12 | ||||
-rw-r--r-- | tests/00confnames | 79 | ||||
-rw-r--r-- | tests/templates/names_template | 7 |
13 files changed, 76 insertions, 100 deletions
diff --git a/Incremental.c b/Incremental.c index 6cbc164..30c07c0 100644 --- a/Incremental.c +++ b/Incremental.c @@ -1467,6 +1467,15 @@ static int Incremental_container(struct supertype *st, char *devname, st->ss->getinfo_super(st, &info, NULL); + if (info.container_enough < 0 || (info.container_enough == 0 && c->runstop < 1)) { + 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; @@ -28,10 +28,10 @@ #include "mdadm.h" #ifndef VERSION -#define VERSION "4.2" +#define VERSION "4.3" #endif #ifndef VERS_DATE -#define VERS_DATE "2021-12-30" +#define VERS_DATE "2024-02-15" #endif #ifndef EXTRAVERSION #define EXTRAVERSION "" @@ -262,6 +262,7 @@ pass: * @cmdline: context dependent actions. * * If criteria passed, set name in @ident. + * Note: name is not used by config file, it for cmdline only. * * Return: %MDADM_STATUS_SUCCESS or %MDADM_STATUS_ERROR. */ @@ -571,7 +572,8 @@ void arrayline(char *line) mis.super_minor = minor; } } else if (strncasecmp(w, "name=", 5) == 0) { - _ident_set_name(&mis, w + 5, false); + /* Ignore name in confile */ + continue; } else if (strncasecmp(w, "bitmap=", 7) == 0) { if (mis.bitmap_file) pr_err("only specify bitmap file once. %s ignored\n", @@ -1279,13 +1281,7 @@ struct mddev_ident *conf_match(struct supertype *st, array_list->devname); continue; } - if (array_list->name[0] && - strcasecmp(array_list->name, info->name) != 0) { - if (verbose >= 2 && array_list->devname) - pr_err("Name differs from %s.\n", - array_list->devname); - continue; - } + if (array_list->devices && devname && !match_oneof(array_list->devices, devname)) { if (verbose >= 2 && array_list->devname) @@ -5,7 +5,7 @@ .\" the Free Software Foundation; either version 2 of the License, or .\" (at your option) any later version. .\" See file COPYING in distribution for details. -.TH MDADM 8 "" v4.2 +.TH MDADM 8 "" v4.3 .SH NAME mdadm \- manage MD devices .I aka diff --git a/mdadm.conf.5.in b/mdadm.conf.5.in index 94e23dd..787e51e 100644 --- a/mdadm.conf.5.in +++ b/mdadm.conf.5.in @@ -133,13 +133,6 @@ The value should be a 128 bit uuid in hexadecimal, with punctuation interspersed if desired. This must match the uuid stored in the superblock. .TP -.B name= -The value should be a simple textual name as was given to -.I mdadm -when the array was created. This must match the name stored in the -superblock on a device for that device to be included in the array. -Not all superblock formats support names. -.TP .B super\-minor= The value is an integer which indicates the minor number that was stored in the superblock when the array was created. When an array is @@ -377,6 +377,13 @@ struct mdinfo { int container_member; /* for assembling external-metatdata arrays * This is to be used internally by metadata * handler only */ + /** + * flag external handlers can set to indicate that subarrays have: + * - not enough disks to start (-1), + * - enough disks to start (0), + * - all expected disks (1). + */ + int container_enough; char sys_name[32]; struct mdinfo *devs; struct mdinfo *next; @@ -1,6 +1,6 @@ Summary: mdadm is used for controlling Linux md devices (aka RAID arrays) Name: mdadm -Version: 4.2 +Version: 4.3 Release: 1 Source: https://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.gz URL: https://neil.brown.name/blog/mdadm @@ -1,5 +1,5 @@ .\" See file COPYING in distribution for details. -.TH MDMON 8 "" v4.2 +.TH MDMON 8 "" v4.3 .SH NAME mdmon \- monitor MD external metadata arrays diff --git a/super-ddf.c b/super-ddf.c index a87e316..7571e3b 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 6a664a2..dbea235 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,11 +3840,37 @@ 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); } + info->container_enough = max_enough; + if (super->disks) { __u32 reserved = imsm_reserved_sectors(super, super->disks); @@ -645,10 +645,6 @@ static void brief_examine_super1(struct supertype *st, int verbose) printf(":"); printf("%02x", sb->set_uuid[i]); } - if (sb->set_name[0]) { - printf(" name="); - print_quoted(sb->set_name); - } printf("\n"); } @@ -875,10 +871,6 @@ static void brief_detail_super1(struct supertype *st, char *subarray) struct mdp_superblock_1 *sb = st->sb; int i; - if (sb->set_name[0]) { - printf(" name="); - print_quoted(sb->set_name); - } printf(" UUID="); for (i = 0; i < 16; i++) { if ((i & 3) == 0 && i != 0) @@ -1356,6 +1348,10 @@ static int update_super1(struct supertype *st, struct mdinfo *info, __cpu_to_le16(info->disk.raid_disk); break; } + case UOPT_RESYNC: + /* make sure resync happens */ + sb->resync_offset = 0; + break; case UOPT_UUID: copy_uuid(sb->set_uuid, info->uuid, super1.swapuuid); diff --git a/tests/00confnames b/tests/00confnames index 10823f0..191a905 100644 --- a/tests/00confnames +++ b/tests/00confnames @@ -1,10 +1,8 @@ set -x -e . tests/templates/names_template -# Test how <devname> and <name> from config are handled during Incremental assemblation. -# 1-6 <devnode> only tests (no <name> in config). -# 6-10 <devname> and <name> combinations are tested. -# 11-13 corner cases. +# Test how <devname> is handled during Incremental assemblation with +# config file and ARRAYLINE specified. names_create "/dev/md/name" local _UUID="$(mdadm -D --export /dev/md127 | grep MD_UUID | cut -d'=' -f2)" @@ -12,96 +10,47 @@ local _UUID="$(mdadm -D --export /dev/md127 | grep MD_UUID | cut -d'=' -f2)" # 1. <devname> definition consistent with metadata name. -names_make_conf $_UUID "/dev/md/name" "empty" $config +names_make_conf $_UUID "/dev/md/name" $config mdadm -S "/dev/md127" mdadm -I $dev0 --config=$config names_verify "/dev/md127" "name" "name" mdadm -S "/dev/md127" # 2. Same as 1, but use short name form of <devname>. -names_make_conf $_UUID "name" "empty" $config +names_make_conf $_UUID "name" $config mdadm -I $dev0 --config=$config names_verify "/dev/md127" "name" "name" mdadm -S "/dev/md127" # 3. Same as 1, but use different <devname> than metadata provides. -names_make_conf $_UUID "/dev/md/other" "empty" $config +names_make_conf $_UUID "/dev/md/other" $config mdadm -I $dev0 --config=$config names_verify "/dev/md127" "other" "name" mdadm -S "/dev/md127" # 4. Same as 3, but use short name form of <devname>. -names_make_conf $_UUID "other" "empty" $config +names_make_conf $_UUID "other" $config mdadm -I $dev0 --config=$config names_verify "/dev/md127" "other" "name" mdadm -S "/dev/md127" -# 5. Force particular node creation by setting <devname> to /dev/mdX. Link is not created in this -# case. -names_make_conf $_UUID "/dev/md4" "empty" $config +# 5. Force particular node creation by setting <devname> to /dev/mdX. +# Link is not created in this case. +names_make_conf $_UUID "/dev/md4" $config mdadm -I $dev0 --config=$config names_verify "/dev/md4" "empty" "name" mdadm -S "/dev/md4" -# 6. <devname> set to /dev/mdX, <name> same as in metadata. -# Metadata name and default node used - controversial. Current behavior documented. -names_make_conf $_UUID "/dev/md22" "name" $config -mdadm -I $dev0 --config=$config -names_verify "/dev/md127" "name" "name" -mdadm -S "/dev/md127" - -# 7. <devname> set to /dev/mdX, <name> different than in metadata. -# Metadata name and default node used - controversial. Current behavior documented. -names_make_conf $_UUID "/dev/md8" "other" $config -mdadm -I $dev0 --config=$config -names_verify "/dev/md127" "name" "name" -mdadm -S "/dev/md127" - -# 8. Both <devname> and <name> different than in metadata. -# Metadata name and default node used - controversial. Current behavior documented. -names_make_conf $_UUID "devnode" "other_name" $config -mdadm -I $dev0 --config=$config -names_verify "/dev/md127" "name" "name" -mdadm -S "/dev/md127" - -# 9. <devname> set to metadata name, <name> different than in metadata. -# Metadata name and default node used - controversial. Current behavior documented. -names_make_conf $_UUID "name" "other_name" $config -mdadm -I $dev0 --config=$config -names_verify "/dev/md127" "name" "name" -mdadm -S "/dev/md127" - -# 10. Bad <devname> set, no <name>. -# Metadata name and default node used - expected. -names_make_conf $_UUID "/im/bad/devname" "empty" $config -mdadm -I $dev0 --config=$config -names_verify "/dev/md127" "name" "name" -mdadm -S "/dev/md127" - -# 11. <devname> with some special symbols and locales, no <name>. +# 6. <devname> with some special symbols and locales. # <devname> should be ignored. -names_make_conf $_UUID "tźż-\.,<>st+-" "empty" $config -mdadm -I $dev0 --config=$config -names_verify "/dev/md127" "name" "name" -mdadm -S "/dev/md127" - -# 12. No <devname> and <name> set. -# Metadata name and default node used - expected. -names_make_conf $_UUID "empty" "empty" $config -mdadm -I $dev0 --config=$config -names_verify "/dev/md127" "name" "name" -mdadm -S "/dev/md127" - -# 13. No <devname>, <name> set to /dev/mdX. -# Entry should be ignored, it is not ignored but result is good anyway. -names_make_conf $_UUID "empty" "/dev/md12" $config +names_make_conf $_UUID "tźż-\.,<>st+-" $config mdadm -I $dev0 --config=$config names_verify "/dev/md127" "name" "name" mdadm -S "/dev/md127" -# 13. No <devname>, <name> with special symbols and locales. -# Entry should be ignored, it is not ignored but result is good anyway. -names_make_conf $_UUID "empty" "./\śćń#&" $config +# 7. No <devname> set. +# Metadata name and default node used. +names_make_conf $_UUID "empty" $config mdadm -I $dev0 --config=$config names_verify "/dev/md127" "name" "name" mdadm -S "/dev/md127" diff --git a/tests/templates/names_template b/tests/templates/names_template index 6181bfa..1b6cd14 100644 --- a/tests/templates/names_template +++ b/tests/templates/names_template @@ -63,8 +63,7 @@ function names_verify() { names_make_conf() { local UUID="$1" local WANTED_DEVNAME="$2" - local WANTED_NAME="$3" - local CONF="$4" + local CONF="$3" local LINE="ARRAY metadata=1.2 UUID=$UUID" @@ -72,9 +71,5 @@ names_make_conf() { LINE="$LINE $WANTED_DEVNAME" fi - if [[ "$WANTED_NAME" != "empty" ]]; then - LINE="$LINE name=$WANTED_NAME" - fi - echo $LINE > $CONF } |