Hi Yu Kuai,
On 24/01/25 07:48, Yu Kuai wrote:
在 2025/01/24 9:30, Yu Kuai 写道:
...
Please use this patch, I found that last patch has problem while testing.
Thanks for the patch. After applying the below patch the problem is not reproducible anymore. The boot succeeds without panic.
Regards, Harshit
Thanks,
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c index 63879582d1c3..e01c2d0479e3 100644 --- a/drivers/md/md-bitmap.c +++ b/drivers/md/md-bitmap.c @@ -2340,7 +2340,10 @@ static int bitmap_get_stats(void *data, struct md_bitmap_stats *stats)
if (!bitmap) return -ENOENT;
+ if (bitmap->mddev->bitmap_info.external) + return -ENOENT; + if (!bitmap->storage.sb_page) /* no superblock */ + return -EINVAL; sb = kmap_local_page(bitmap->storage.sb_page); stats->sync_size = le64_to_cpu(sb->sync_size); kunmap_local(sb); diff --git a/drivers/md/md.c b/drivers/md/md.c index 94166b2e9512..c9de57701e43 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -8470,6 +8470,10 @@ static int md_seq_show(struct seq_file *seq, void *v) return 0;
spin_unlock(&all_mddevs_lock);
+ /* prevent bitmap to be freed after checking */ + mutex_lock(&mddev->bitmap_info.mutex);
spin_lock(&mddev->lock); if (mddev->pers || mddev->raid_disks || !list_empty(&mddev-
disks)) {
seq_printf(seq, "%s : ", mdname(mddev)); @@ -8545,6 +8549,7 @@ static int md_seq_show(struct seq_file *seq, void *v) seq_printf(seq, "\n"); } spin_unlock(&mddev->lock); + mutex_unlock(&mddev->bitmap_info.mutex); spin_lock(&all_mddevs_lock);
if (mddev == list_last_entry(&all_mddevs, struct mddev, all_mddevs))