From: Yu Kuai <yuku...@huawei.com>

Prepare to support building md-bitmap as kernel module.

dm-raid should always enable bitmap and mdraid will try to load the module
automatically, just in case the module can't be loaded, for example,
user somehow remove the module file.

Signed-off-by: Yu Kuai <yuku...@huawei.com>
---
 drivers/md/dm-raid.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 0ca73b571c7d..c56c42503ca4 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -3054,6 +3054,9 @@ static int raid_ctr(struct dm_target *ti, unsigned int 
argc, char **argv)
        if (IS_ERR(rs))
                return PTR_ERR(rs);
 
+       if (WARN_ON_ONCE(!md_bitmap_registered(&rs->md)))
+               goto bad;
+
        r = parse_raid_params(rs, &as, num_raid_params);
        if (r)
                goto bad;
-- 
2.39.2


Reply via email to