Try this: mdadm --zero-super /dev/sd* mdadm -C /dev/md/imsm -n2 -eimsm /dev/sdb /dev/sdc --run mdadm -C /dev/md/r1 -n2 -z15G -eimsm /dev/sdb /dev/sdc -l1 --run --assume-clean mdadm -f /dev/md126 /dev/sdb mdadm -Ss Remember about exporting IMSM_NO_PLATFORM and IMSM_DEVNAME_AS_SERIAL. The problem occurs when map file is freeing. The previous reproduction steps works for me, because I had old, invalid entry in /var/run/mdadm/map. This issue seems to be related with this file. I didn't reproduce it on native metadata without outdated entry in this file. Thanks, Mariusz -----Original Message----- From: Guoqing Jiang [mailto:gqjiang@xxxxxxxx] Sent: Friday, July 13, 2018 10:07 AM To: Tkaczyk, Mariusz <mariusz.tkaczyk@xxxxxxxxx> Subject: Re: [PATCH V2] Free map to avoid resource leak issues On 07/13/2018 02:34 PM, Tkaczyk, Mariusz wrote: > Please export IMSM_DEVNAME_AS_SERIAL=1. > Sorry, I forgot about it. I built mdadm from the latest tree (with commit cf42a1c7074a "tests, imsm: Calculate expected array_size in proper way"), but still can't reproduce it. gqj-bsc1098449-1:~ # mdadm --zero /dev/sd[b-c] mdadm: Unrecognised md component device - /dev/sdb mdadm: Unrecognised md component device - /dev/sdc gqj-bsc1098449-1:~ # export IMSM_DEVNAME_AS_SERIAL=1 gqj-bsc1098449-1:~ # mdadm -C /dev/md/imsm -eimsm -n2 /dev/sd[b-c] --run mdadm: /dev/sdb is not attached to Intel(R) RAID controller. mdadm: /dev/sdb is not suitable for this array. mdadm: /dev/sdc is not attached to Intel(R) RAID controller. mdadm: /dev/sdc is not suitable for this array. mdadm: create aborted gqj-bsc1098449-1:~ # export IMSM_NO_PLATFORM=1 gqj-bsc1098449-1:~ # mdadm -C /dev/md/imsm -eimsm -n2 /dev/sd[b-c] --run mdadm: container /dev/md/imsm prepared. gqj-bsc1098449-1:~ # mdadm -Ss So I guess you need to double check what the commit changed to fix the issue, :-) Thanks, Guoqing > > Thanks Mariusz > > -----Original Message----- > From: Guoqing Jiang [mailto:gqjiang@xxxxxxxx] > Sent: Friday, July 13, 2018 4:23 AM > To: Tkaczyk, Mariusz <mariusz.tkaczyk@xxxxxxxxx> > Cc: linux-raid@xxxxxxxxxxxxxxx; Jes Sorensen <jes.sorensen@xxxxxxxxx> > Subject: Re: [PATCH V2] Free map to avoid resource leak issues > > > > On 07/12/2018 10:25 PM, Tkaczyk, Mariusz wrote: >> Hi, >> After this patch I found problem with "double free or corruption". >> >> Steps to reproduce: >> >> mdadm --zero-super-block /dev/sd* >> >> mdadm -C /dev/md/imsm -eimsm -n2 /dev/sd[b-c] --run > Sorry, I got trouble to reproduce it because of core dump issue. > > :~ # export IMSM_NO_PLATFORM=1 > :~ # mdadm --zero /dev/vd[b-c] > mdadm: Unrecognised md component device - /dev/vdb > mdadm: Unrecognised md component device - /dev/vdc :~ # mdadm -C > /dev/md/imsm -eimsm -n2 /dev/vd[b-c] --run > mdadm: Failed to retrieve serial for /dev/vdb > mdadm: failed to retrieve scsi serial, aborting Aborted (core dumped) > > And I can see the below backtrace. > > [snip] > Core was generated by `mdadm -C /dev/md/imsm -eimsm -n2 /dev/vdb /dev/vdc --run'. > Program terminated with signal SIGABRT, Aborted. > #0 0x00007feaab7ee0e0 in raise () from /lib64/libc.so.6 > (gdb) bt > #0 0x00007feaab7ee0e0 in raise () from /lib64/libc.so.6 > #1 0x00007feaab7ef6c1 in abort () from /lib64/libc.so.6 > #2 0x000056232317d6cb in ?? () > #3 0x0000562323144054 in ?? () > #4 0x000056232312b692 in ?? () > #5 0x00007feaab7d8f4a in __libc_start_main () from /lib64/libc.so.6 > #6 0x000056232312cc2a in ?? () > > BTW: I am using 4.12.14-23-default kernel and mdadm version is mdadm - > v4.0 - 2017-01-09. > > Thanks, > Guoqing > >> mdadm -Ss >> >> *** Error in `mdadm': double free or corruption (fasttop): >> 0x00000000019b82c0 *** ======= Backtrace: ========= >> /lib64/libc.so.6(+0x7c619)[0x7f06ae071619] >> mdadm[0x47a68d] >> mdadm[0x47a426] >> mdadm[0x416359] >> mdadm[0x4083a2] >> mdadm[0x4076b3] >> /lib64/libc.so.6(__libc_start_main+0xf5)[0x7f06ae016c05] >> mdadm[0x402fc9] >> ======= Memory map: ======== >> 00400000-0049d000 r-xp 00000000 08:06 527991 /usr/sbin/mdadm >> 0069d000-0069e000 r--p 0009d000 08:06 527991 /usr/sbin/mdadm >> 0069e000-006a6000 rw-p 0009e000 08:06 527991 /usr/sbin/mdadm >> 006a6000-006bb000 rw-p 00000000 00:00 0 >> 019b8000-019d9000 rw-p 00000000 00:00 0 [heap] >> 7f06a8000000-7f06a8021000 rw-p 00000000 00:00 0 >> 7f06a8021000-7f06ac000000 ---p 00000000 00:00 0 >> 7f06adddf000-7f06addf4000 r-xp 00000000 08:06 542510 /usr/lib64/libgcc_s-4.8.5-20150702.so.1 >> 7f06addf4000-7f06adff3000 ---p 00015000 08:06 542510 /usr/lib64/libgcc_s-4.8.5-20150702.so.1 >> 7f06adff3000-7f06adff4000 r--p 00014000 08:06 542510 /usr/lib64/libgcc_s-4.8.5-20150702.so.1 >> 7f06adff4000-7f06adff5000 rw-p 00015000 08:06 542510 /usr/lib64/libgcc_s-4.8.5-20150702.so.1 >> 7f06adff5000-7f06ae1ad000 r-xp 00000000 08:06 532084 /usr/lib64/libc-2.17.so >> 7f06ae1ad000-7f06ae3ad000 ---p 001b8000 08:06 532084 /usr/lib64/libc-2.17.so >> 7f06ae3ad000-7f06ae3b1000 r--p 001b8000 08:06 532084 /usr/lib64/libc-2.17.so >> 7f06ae3b1000-7f06ae3b3000 rw-p 001bc000 08:06 532084 /usr/lib64/libc-2.17.so >> 7f06ae3b3000-7f06ae3b8000 rw-p 00000000 00:00 0 >> 7f06ae3b8000-7f06ae3ba000 r-xp 00000000 08:06 532090 /usr/lib64/libdl-2.17.so >> 7f06ae3ba000-7f06ae5ba000 ---p 00002000 08:06 532090 /usr/lib64/libdl-2.17.so >> 7f06ae5ba000-7f06ae5bb000 r--p 00002000 08:06 532090 /usr/lib64/libdl-2.17.so >> 7f06ae5bb000-7f06ae5bc000 rw-p 00003000 08:06 532090 /usr/lib64/libdl-2.17.so >> 7f06ae5bc000-7f06ae5dd000 r-xp 00000000 08:06 524304 /usr/lib64/ld-2.17.so >> 7f06ae7ce000-7f06ae7d1000 rw-p 00000000 00:00 0 >> 7f06ae7db000-7f06ae7dd000 rw-p 00000000 00:00 0 >> 7f06ae7dd000-7f06ae7de000 r--p 00021000 08:06 524304 /usr/lib64/ld-2.17.so >> 7f06ae7de000-7f06ae7df000 rw-p 00022000 08:06 524304 /usr/lib64/ld-2.17.so >> 7f06ae7df000-7f06ae7e0000 rw-p 00000000 00:00 0 >> 7ffdd9af7000-7ffdd9b18000 rw-p 00000000 00:00 0 [stack] >> 7ffdd9b82000-7ffdd9b85000 r--p 00000000 00:00 0 [vvar] >> 7ffdd9b85000-7ffdd9b87000 r-xp 00000000 00:00 0 [vdso] >> ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] >> Aborted >> >> Can you fix it? >> If you don't have IMSM platform you can export IMSM_NO_PLATFORM=1. >> >> Thanks, >> Mariusz >> N r y b X ǧv ^ ){.n + { {ay ʇڙ ,j f h z w > j:+v w j m zZ+ ݢj" !tml= > ��.n��������+%������w��{.n�����{����w��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f