]> git.ipfire.org Git - thirdparty/mdadm.git/commit
super1: Clear extra flags when initializing metadata
authorWu Guanghao <wuguanghao3@huawei.com>
Tue, 11 Mar 2025 03:11:55 +0000 (03:11 +0000)
committerMariusz Tkaczyk <mtkaczyk@kernel.org>
Mon, 24 Mar 2025 09:44:20 +0000 (10:44 +0100)
commit4e2e208c8d3e9ba0fae88136d7c4cd0292af73b0
treecd03b38bc5666ff747aba643707939202140fcc7
parentc2fbf66ba0243f499f78ed43fa1207a9bd9361b5
super1: Clear extra flags when initializing metadata

When adding a disk to a RAID1 array, the metadata is read from the
existing member disks for sync. However, only the bad_blocks flag are
copied, the bad_blocks records are not copied, so the bad_blocks
records are all zeros. The kernel function super_1_load() detects
bad_blocks flag and reads the bad_blocks record, then sets the bad
block using badblocks_set().

After the kernel commit 1726c7746783 (badblocks: improve badblocks_set()
for multiple ranges handling) if the length of a bad_blocks record is 0,
it will return a failure. Therefore the device addition will fail.

So when adding a new disk, some flags cannot be sync and need to be clead.

Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
super1.c
tests/05r1-add-badblocks [new file with mode: 0644]