1
0
Fork 0

Merging upstream version 4.3.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-14 06:33:29 +01:00
parent 07b992239b
commit 0a7cc54657
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
13 changed files with 76 additions and 100 deletions

View file

@ -1467,6 +1467,15 @@ static int Incremental_container(struct supertype *st, char *devname,
st->ss->getinfo_super(st, &info, NULL); 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); match = conf_match(st, &info, devname, c->verbose, &rv);
if (match == NULL && rv == 2) if (match == NULL && rv == 2)
return rv; return rv;

View file

@ -28,10 +28,10 @@
#include "mdadm.h" #include "mdadm.h"
#ifndef VERSION #ifndef VERSION
#define VERSION "4.2" #define VERSION "4.3"
#endif #endif
#ifndef VERS_DATE #ifndef VERS_DATE
#define VERS_DATE "2021-12-30" #define VERS_DATE "2024-02-15"
#endif #endif
#ifndef EXTRAVERSION #ifndef EXTRAVERSION
#define EXTRAVERSION "" #define EXTRAVERSION ""

View file

@ -262,6 +262,7 @@ pass:
* @cmdline: context dependent actions. * @cmdline: context dependent actions.
* *
* If criteria passed, set name in @ident. * 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. * Return: %MDADM_STATUS_SUCCESS or %MDADM_STATUS_ERROR.
*/ */
@ -571,7 +572,8 @@ void arrayline(char *line)
mis.super_minor = minor; mis.super_minor = minor;
} }
} else if (strncasecmp(w, "name=", 5) == 0) { } 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) { } else if (strncasecmp(w, "bitmap=", 7) == 0) {
if (mis.bitmap_file) if (mis.bitmap_file)
pr_err("only specify bitmap file once. %s ignored\n", 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); array_list->devname);
continue; 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 && if (array_list->devices && devname &&
!match_oneof(array_list->devices, devname)) { !match_oneof(array_list->devices, devname)) {
if (verbose >= 2 && array_list->devname) if (verbose >= 2 && array_list->devname)

View file

@ -5,7 +5,7 @@
.\" the Free Software Foundation; either version 2 of the License, or .\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version. .\" (at your option) any later version.
.\" See file COPYING in distribution for details. .\" See file COPYING in distribution for details.
.TH MDADM 8 "" v4.2 .TH MDADM 8 "" v4.3
.SH NAME .SH NAME
mdadm \- manage MD devices mdadm \- manage MD devices
.I aka .I aka

View file

@ -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 interspersed if desired. This must match the uuid stored in the
superblock. superblock.
.TP .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= .B super\-minor=
The value is an integer which indicates the minor number that was 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 stored in the superblock when the array was created. When an array is

View file

@ -377,6 +377,13 @@ struct mdinfo {
int container_member; /* for assembling external-metatdata arrays int container_member; /* for assembling external-metatdata arrays
* This is to be used internally by metadata * This is to be used internally by metadata
* handler only */ * 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]; char sys_name[32];
struct mdinfo *devs; struct mdinfo *devs;
struct mdinfo *next; struct mdinfo *next;

View file

@ -1,6 +1,6 @@
Summary: mdadm is used for controlling Linux md devices (aka RAID arrays) Summary: mdadm is used for controlling Linux md devices (aka RAID arrays)
Name: mdadm Name: mdadm
Version: 4.2 Version: 4.3
Release: 1 Release: 1
Source: https://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.gz Source: https://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.gz
URL: https://neil.brown.name/blog/mdadm URL: https://neil.brown.name/blog/mdadm

View file

@ -1,5 +1,5 @@
.\" See file COPYING in distribution for details. .\" See file COPYING in distribution for details.
.TH MDMON 8 "" v4.2 .TH MDMON 8 "" v4.3
.SH NAME .SH NAME
mdmon \- monitor MD external metadata arrays mdmon \- monitor MD external metadata arrays

View file

@ -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.ctime = DECADE + __be32_to_cpu(*cptr);
info->array.chunk_size = 0; info->array.chunk_size = 0;
info->container_enough = 1;
info->disk.major = 0; info->disk.major = 0;
info->disk.minor = 0; info->disk.minor = 0;

View file

@ -3778,6 +3778,7 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char *
struct intel_super *super = st->sb; struct intel_super *super = st->sb;
struct imsm_disk *disk; struct imsm_disk *disk;
int map_disks = info->array.raid_disks; int map_disks = info->array.raid_disks;
int max_enough = -1;
int i; int i;
struct imsm_super *mpb; 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++) { for (i = 0; i < mpb->num_raid_devs; i++) {
struct imsm_dev *dev = get_imsm_dev(super, i); struct imsm_dev *dev = get_imsm_dev(super, i);
int j = 0; int failed, enough, j, missing = 0;
struct imsm_map *map; 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); map = get_imsm_map(dev, MAP_0);
/* any newly missing disks? /* 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) && if (!(ord & IMSM_ORD_REBUILD) &&
get_imsm_missing(super, idx)) { get_imsm_missing(super, idx)) {
missing = 1;
break; 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) { if (super->disks) {
__u32 reserved = imsm_reserved_sectors(super, super->disks); __u32 reserved = imsm_reserved_sectors(super, super->disks);

View file

@ -645,10 +645,6 @@ static void brief_examine_super1(struct supertype *st, int verbose)
printf(":"); printf(":");
printf("%02x", sb->set_uuid[i]); printf("%02x", sb->set_uuid[i]);
} }
if (sb->set_name[0]) {
printf(" name=");
print_quoted(sb->set_name);
}
printf("\n"); printf("\n");
} }
@ -875,10 +871,6 @@ static void brief_detail_super1(struct supertype *st, char *subarray)
struct mdp_superblock_1 *sb = st->sb; struct mdp_superblock_1 *sb = st->sb;
int i; int i;
if (sb->set_name[0]) {
printf(" name=");
print_quoted(sb->set_name);
}
printf(" UUID="); printf(" UUID=");
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if ((i & 3) == 0 && i != 0) 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); __cpu_to_le16(info->disk.raid_disk);
break; break;
} }
case UOPT_RESYNC:
/* make sure resync happens */
sb->resync_offset = 0;
break;
case UOPT_UUID: case UOPT_UUID:
copy_uuid(sb->set_uuid, info->uuid, super1.swapuuid); copy_uuid(sb->set_uuid, info->uuid, super1.swapuuid);

View file

@ -1,10 +1,8 @@
set -x -e set -x -e
. tests/templates/names_template . tests/templates/names_template
# Test how <devname> and <name> from config are handled during Incremental assemblation. # Test how <devname> is handled during Incremental assemblation with
# 1-6 <devnode> only tests (no <name> in config). # config file and ARRAYLINE specified.
# 6-10 <devname> and <name> combinations are tested.
# 11-13 corner cases.
names_create "/dev/md/name" names_create "/dev/md/name"
local _UUID="$(mdadm -D --export /dev/md127 | grep MD_UUID | cut -d'=' -f2)" 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. # 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 -S "/dev/md127"
mdadm -I $dev0 --config=$config mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name" names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127" mdadm -S "/dev/md127"
# 2. Same as 1, but use short name form of <devname>. # 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 mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name" names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127" mdadm -S "/dev/md127"
# 3. Same as 1, but use different <devname> than metadata provides. # 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 mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "other" "name" names_verify "/dev/md127" "other" "name"
mdadm -S "/dev/md127" mdadm -S "/dev/md127"
# 4. Same as 3, but use short name form of <devname>. # 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 mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "other" "name" names_verify "/dev/md127" "other" "name"
mdadm -S "/dev/md127" mdadm -S "/dev/md127"
# 5. Force particular node creation by setting <devname> to /dev/mdX. Link is not created in this # 5. Force particular node creation by setting <devname> to /dev/mdX.
# case. # Link is not created in this case.
names_make_conf $_UUID "/dev/md4" "empty" $config names_make_conf $_UUID "/dev/md4" $config
mdadm -I $dev0 --config=$config mdadm -I $dev0 --config=$config
names_verify "/dev/md4" "empty" "name" names_verify "/dev/md4" "empty" "name"
mdadm -S "/dev/md4" mdadm -S "/dev/md4"
# 6. <devname> set to /dev/mdX, <name> same as in metadata. # 6. <devname> with some special symbols and locales.
# 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>.
# <devname> should be ignored. # <devname> should be ignored.
names_make_conf $_UUID "tźż-\.,<>st+-" "empty" $config names_make_conf $_UUID "tźż-\.,<>st+-" $config
mdadm -I $dev0 --config=$config mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name" names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127" mdadm -S "/dev/md127"
# 12. No <devname> and <name> set. # 7. No <devname> set.
# Metadata name and default node used - expected. # Metadata name and default node used.
names_make_conf $_UUID "empty" "empty" $config names_make_conf $_UUID "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
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
mdadm -I $dev0 --config=$config mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name" names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127" mdadm -S "/dev/md127"

View file

@ -63,8 +63,7 @@ function names_verify() {
names_make_conf() { names_make_conf() {
local UUID="$1" local UUID="$1"
local WANTED_DEVNAME="$2" local WANTED_DEVNAME="$2"
local WANTED_NAME="$3" local CONF="$3"
local CONF="$4"
local LINE="ARRAY metadata=1.2 UUID=$UUID" local LINE="ARRAY metadata=1.2 UUID=$UUID"
@ -72,9 +71,5 @@ names_make_conf() {
LINE="$LINE $WANTED_DEVNAME" LINE="$LINE $WANTED_DEVNAME"
fi fi
if [[ "$WANTED_NAME" != "empty" ]]; then
LINE="$LINE name=$WANTED_NAME"
fi
echo $LINE > $CONF echo $LINE > $CONF
} }