Attached scripts will verify:
- mdadm 3.4-4ubuntu0.1 (for zesty) puts a bbl on a bitmap and causes disruption, and
- mdadm 4.0-2 (for artful) adjusts position of a bbl according to bitmap size.
I've attached some scripts to reproduce the bug. These scripts are tested with Ubuntu xenial.
- prepare.sh : prepare for experiments
- makes directories
- downloads mdadm deb packages
- procedure.sh : run an experiment
- creates loopback devices which are used as MD components
- creates MD devices
- examines bbl
- cleanup.sh : cleanup an experiment
- deletes MD devices
- deletes loopback devices
- variables.sh : definition of common variables
procedure.sh creates a bitmap with the size calculated as the bitmap can overlap with a bbl. It is expected that a bitmap overlaps with a bbl by using mdadm 3.4-4ubuntu0.1 (for zesty), doesn't overlap by using mdadm 4.0-2 (for artful).
./procedure.sh zesty
creates block devices which will be used as MD components, then assembles MD devices.
After assembling, it shows the result of mdadm --examine
and mdadm --examine-badblocks
.
+ sudo /home/kota_uchida/mdadm/archives/zesty/contents/sbin/mdadm -E /dev/loop0
/dev/loop0:
...
Super Offset : 8 sectors
...
Bad Block Log : 512 entries available at offset 72 sectors - bad blocks present.
...
+ sudo /home/kota_uchida/mdadm/archives/zesty/contents/sbin/mdadm --examine-badblocks /dev/mapper/disk_with_badblock
Bad-blocks on /dev/mapper/disk_with_badblock:
17384 for 8 sectors
The result shows:
- The bbl is places at 80 sectors from the beginning of
/dev/loop0
.- Offset of the bbl is 72 sectors from the super block.
- Offset of the super block is 8 sectors from the beginning of the device.
- Only one entry is in the bbl just after the MD device was assembled and MD detects a bad sector correctly.
- One bad sector has been created at 17384 sector. See procedure.sh.
After 20 seconds, the bbl will be in inconsistent status.
+ sleep 20
+ tail -n 5
+ sudo /home/kota_uchida/mdadm/archives/zesty/contents/sbin/mdadm --examine-badblocks /dev/mapper/disk_with_badblock
0 for 0 sectors
0 for 0 sectors
0 for 0 sectors
0 for 0 sectors
0 for 0 sectors
You can test the bug with mdadm 4.0-2 (for artful) by running ./cleanup.sh
and then ./procedure.sh artful
.
With mdadm 4.0-2 (for artful), the bug shall not occur because a bbl will be created at a position outside a bitmap.