mdadm: minor fixes
v2 cover mdadm: minor fixes
There are some building errors and regression bug.
The PR is at https://github.com/md-raid-utilities/mdadm/pull/178
v2 adds the 4 more patches.
Xiao Ni (7):
mdadm: use standard libc nftw
mdadm: fix building errors
mdadm: add attribute nonstring for signature
mdadm: give more time to wait sync thread to reap mdadm/tests: mark 10ddf-fail-two-spares broken mdadm/tests: mark 09imsm-assemble broken mdadm/tests: mark 10ddf-fail-readd-readonly broken
lib.c | 22 ------------------- platform-intel.h | 2 +- super-ddf.c | 9 ++++---- super-intel.c | 3 ++- tests/09imsm-assemble.broken | 30 ++++++++++++++++++++++++++ tests/10ddf-fail-readd-readonly.broken | 22 +++++++++++++++++++ tests/10ddf-fail-two-spares.broken | 11 ++++++++++ tests/func.sh | 5 ++++- 8 files changed, 75 insertions(+), 29 deletions(-) create mode 100644 tests/09imsm-assemble.broken create mode 100644 tests/10ddf-fail-readd-readonly.broken create mode 100644 tests/10ddf-fail-two-spares.broken
Signature · 1 line
2.32.0 (Apple Git-132)
PATCH v2 1/7 mdadm: use standard libc nftw
commit bd648e3bec3d ("mdadm: Remove klibc and uclibc support") removes macro HAVE_NFTW/HAVE_FTW and uses libc header ftw.h. But it leaves the codes in lib.c which let mdadm command call nftw defined in lib.c. It needs to remove these codes.
The bug can be reproduced by:
mdadm -CR /dev/md0 --level raid5 --metadata=1.1 --chunk=32 --raid-disks 3 --size 10000 /dev/loop1 /dev/loop2 /dev/loop3
mdadm /dev/md0 --grow --chunk=64
mdadm: /dev/md0: cannot open component -unknown-
--- lib.c | 22 ---------------------- 1 file changed, 22 deletions(-)
lib.c +0 -22
@@ -245,28 +245,6 @@ int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s)return 0 ; } -#ifndef HAVE_NFTW -#ifdef HAVE_FTW -int add_dev_1 (const char *name,const struct stat *stb,int flag) -{ -return add_dev (name, stb, flag,NULL ); -} -int nftw (const char *path, -int (*han)(const char *name,const struct stat *stb, -int flag,struct FTW *s),int nopenfd,int flags) -{ -return ftw (path, add_dev_1, nopenfd); -} -#else -int nftw (const char *path, -int (*han)(const char *name,const struct stat *stb, -int flag,struct FTW *s),int nopenfd,int flags) -{ -return 0 ; -} -#endif /* HAVE_FTW */ -#endif /* HAVE_NFTW */ -/* * Find a block device with the right major/minor number. * If we find multiple names, choose the shortest.
Signature · 1 line
2.32.0 (Apple Git-132)
PATCH v2 2/7 mdadm: fix building errors
In reply to Xiao NiSome building errors are found in ppc64le platform:
format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'long unsigned int' [-Werror=format=]
--- super-ddf.c | 9 +++++---- super-intel.c | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-)
super-ddf.c +5 -4
@@ -1606,9 +1606,9 @@ static void examine_vd(int n, struct ddf_super *sb, char *guid) map_num(ddf_sec_level, vc->srl) ?: "-unknown-"); }printf (" Device Size[%d] : %llu\n" , n, -be64_to_cpu (vc->blocks)/2 ); + (unsigned long long )(be64_to_cpu (vc->blocks)/2 ));printf (" Array Size[%d] : %llu\n" , n, -be64_to_cpu (vc->array_blocks)/2 ); + (unsigned long long )(be64_to_cpu (vc->array_blocks)/2 )); } }
@@ -1665,7 +1665,7 @@ static void examine_pds(struct ddf_super *sb)printf (" %3d %08x " , i,be32_to_cpu (pd->refnum));printf ("%8lluK " , -be64_to_cpu (pd->config_size)>>1 ); + (unsigned long long )be64_to_cpu (pd->config_size)>>1 );for (dl = sb->dlist; dl ; dl = dl->next) {if (be32_eq (dl->disk.refnum, pd->refnum)) {char *dv =map_dev (dl->major, dl->minor,0 );
@@ -2901,7 +2901,8 @@ static unsigned int find_unused_pde(const struct ddf_super *ddf)static void _set_config_size (struct phys_disk_entry *pde,const struct dl *dl) {__u64 cfs, t; - cfs =min (dl->size -32 *1024 *2ULL ,be64_to_cpu (dl->primary_lba)); + cfs =min ((unsigned long long )dl->size -32 *1024 *2ULL , + (unsigned long long )(be64_to_cpu (dl->primary_lba))); t =be64_to_cpu (dl->secondary_lba);if (t != ~(__u64 )0 ) cfs =min (cfs, t);
super-intel.c +2 -1
@@ -2325,7 +2325,8 @@ static void export_examine_super_imsm(struct supertype *st)printf ("MD_LEVEL=container\n" );printf ("MD_UUID=%s\n" , nbuf+5 );printf ("MD_DEVICES=%u\n" , mpb->num_disks); -printf ("MD_CREATION_TIME=%llu\n" ,__le64_to_cpu (mpb->creation_time)); +printf ("MD_CREATION_TIME=%llu\n" , + (unsigned long long )__le64_to_cpu (mpb->creation_time)); } static void detail_super_imsm(struct supertype *st, char *homehost,
Signature · 1 line
2.32.0 (Apple Git-132)
PATCH v2 3/7 mdadm: add attribute nonstring for signature
In reply to Xiao NiIt reports building error in f42:
error: initializer-string for array of ‘unsigned char’ truncates NULL terminator but destination lacks ‘nonstring’ attribute (5 chars into 4 available) [-Werror=unterminated-string-initialization]
--- platform-intel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
platform-intel.h +1 -1
@@ -24,7 +24,7 @@/* The IMSM Capability (IMSM AHCI and ISCU OROM/EFI variable) Version Table definition */ struct imsm_orom { -__u8 signature[4 ]; +__u8 signature[4 ] __attribute__((nonstring));#define IMSM_OROM_SIGNATURE "$VER"#define IMSM_NVME_OROM_COMPAT_SIGNATURE "$NVM"#define IMSM_VMD_OROM_COMPAT_SIGNATURE "$VMD"
Signature · 1 line
2.32.0 (Apple Git-132)
PATCH v2 4/7 mdadm: give more time to wait sync thread to reap
In reply to Xiao Ni01r5fail case reports error sometimes:
++ '[' -n '2248 / 35840' ']'
++ die 'resync or recovery is happening!'
++ echo -e '\n\tERROR: resync or recovery is happening! \n'
ERROR: resync or recovery is happening!
sync thread is reapped in md_thread. So we need to give more time to wait sync thread to reap.
--- tests/func.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tests/func.sh +4 -1
@@ -357,7 +357,10 @@ check() { done ;; nosync ) - sleep 0.5 + # sync thread is reapped in md_thread, give it more time to wait sync thread + # to reap. Before this change, it gives 0.5s which is too small. Sometimes + # the sync thread can't be reapped and error happens + sleep 3 # Since 4.2 we delay the close of recovery until there has been a chance for # spares to be activated. That means that a recovery that finds nothing # to do can still take a little longer than expected.
Signature · 1 line
2.32.0 (Apple Git-132)
PATCH v2 5/7 mdadm/tests: mark 10ddf-fail-two-spares broken
In reply to Xiao NiSometimes 10ddf-fail-two-spares fail because:
++ grep -q 'state\[1\] : Optimal, Consistent' /tmp/mdtest-5k3MzO ++ echo ERROR: /dev/md/vol1 should be optimal in meta data
ERROR: /dev/md/vol1 should be optimal in meta data
Mark this as broken.
--- tests/10ddf-fail-two-spares.broken | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/10ddf-fail-two-spares.broken
tests/10ddf-fail-two-spares.broken new file +11 -0
@@ -0,0 +1,11 @@ +Sometimes + +++ grep -q 'state\[0\] : Optimal, Consistent' /tmp/mdtest-5k3MzO +++ grep -q 'state\[1\] : Optimal, Consistent' /tmp/mdtest-5k3MzO +++ echo ERROR: /dev/md/vol1 should be optimal in meta data +ERROR: /dev/md/vol1 should be optimal in meta data + +if ! grep -q 'state\[1\] : Optimal, Consistent' $tmp; then + echo ERROR: $member1 should be optimal in meta data + ret=1 +fi
Signature · 1 line
2.32.0 (Apple Git-132)
PATCH v2 6/7 mdadm/tests: mark 09imsm-assemble broken
In reply to Xiao Ni09imsm-assemble fails sometimes. So mark it as broken.
--- tests/09imsm-assemble.broken | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/09imsm-assemble.broken
tests/09imsm-assemble.broken new file +30 -0
@@ -0,0 +1,30 @@ +Sometimes + +Sometimes it fails: +++ /usr/sbin/mdadm --remove /dev/md/container /dev/loop2 +++ rv=1 +++ case $* in +++ cat /var/tmp/stderr +mdadm: /dev/loop2 is still in use, cannot remove. +++ return 1 +++ sleep 2 +++ (( i++ )) +++ (( i<=ret )) +++ '[' 0 -ne 1 ']' +++ echo '/dev/loop2 removal from /dev/md/container should have succeeded' +/dev/loop2 removal from /dev/md/container should have succeeded + +Sometimes it fails: +++ imsm_check_hold /dev/md/container /dev/loop1 +++ mdadm --remove /dev/md/container /dev/loop1 +++ rm -f /var/tmp/stderr +++ case $* in +++ case $* in +++ /usr/sbin/mdadm --remove /dev/md/container /dev/loop1 +++ rv=0 +++ case $* in +++ cat /var/tmp/stderr +mdadm: hot removed /dev/loop1 from /dev/md/container +++ return 0 +++ echo '/dev/loop1 removal from /dev/md/container should have been blocked' +/dev/loop1 removal from /dev/md/container should have been blocked
Signature · 1 line
2.32.0 (Apple Git-132)
PATCH v2 7/7 mdadm/tests: mark 10ddf-fail-readd-readonly broken
In reply to Xiao Ni10ddf-fail-readd-readonly fails sometimes. Mark this case broken.
--- tests/10ddf-fail-readd-readonly.broken | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/10ddf-fail-readd-readonly.broken
tests/10ddf-fail-readd-readonly.broken new file +22 -0
@@ -0,0 +1,22 @@ +Sometimes + +This case fails sometimes like: +mdadm: cannot open MISSING: No such file or directory +++ return 1 +++ grep -q 'state\[0\] : Optimal, Consistent' /tmp/mdtest-bDoaoB +++ echo ERROR: member 0 should be optimal in meta data on MISSING +ERROR: member 0 should be optimal in meta data on MISSING +++ ret=1 +++ for x in $@ +++ mdadm -E /dev/loop9 +++ rm -f /var/tmp/stderr +++ case $* in +++ case $* in +++ /usr/sbin/mdadm -E /dev/loop9 +++ rv=0 +++ case $* in +++ cat /var/tmp/stderr +++ return 0 +++ grep -q 'state\[0\] : Optimal, Consistent' /tmp/mdtest-bDoaoB +++ echo ERROR: member 0 should be optimal in meta data on /dev/loop9 +ERROR: member 0 should be optimal in meta data on /dev/loop9
Signature · 1 line
2.32.0 (Apple Git-132)