Skip to content

Commit c1536df

Browse files
committed
Merge tag 'md-6.19-20251130' of gitolite.kernel.org:pub/scm/linux/kernel/git/mdraid/linux into for-6.19/block
Pull MD changes from Yu: "- fix null-ptr-dereference regression for dm-raid0 (Yu Kuai) - fix IO hang for raid5 when array is broken with IO inflight (Yu Kuai) - remove legacy 1s delay to speed up system shutdown (Tarun Sahu)" * tag 'md-6.19-20251130' of gitolite.kernel.org:pub/scm/linux/kernel/git/mdraid/linux: md: remove legacy 1s delay in md_notify_reboot md/raid5: fix IO hang when array is broken with IO inflight md: warn about updating super block failure md/raid0: fix NULL pointer dereference in create_strip_zones() for dm-raid
2 parents 418de94 + fdd0c6a commit c1536df

3 files changed

Lines changed: 13 additions & 14 deletions

File tree

drivers/md/md.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,6 +2788,7 @@ void md_update_sb(struct mddev *mddev, int force_change)
27882788
if (!md_is_rdwr(mddev)) {
27892789
if (force_change)
27902790
set_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags);
2791+
pr_err("%s: can't update sb for read-only array %s\n", __func__, mdname(mddev));
27912792
return;
27922793
}
27932794

@@ -10407,7 +10408,6 @@ static int md_notify_reboot(struct notifier_block *this,
1040710408
unsigned long code, void *x)
1040810409
{
1040910410
struct mddev *mddev;
10410-
int need_delay = 0;
1041110411

1041210412
spin_lock(&all_mddevs_lock);
1041310413
list_for_each_entry(mddev, &all_mddevs, all_mddevs) {
@@ -10421,21 +10421,11 @@ static int md_notify_reboot(struct notifier_block *this,
1042110421
mddev->safemode = 2;
1042210422
mddev_unlock(mddev);
1042310423
}
10424-
need_delay = 1;
1042510424
spin_lock(&all_mddevs_lock);
1042610425
mddev_put_locked(mddev);
1042710426
}
1042810427
spin_unlock(&all_mddevs_lock);
1042910428

10430-
/*
10431-
* certain more exotic SCSI devices are known to be
10432-
* volatile wrt too early system reboots. While the
10433-
* right place to handle this issue is the given
10434-
* driver, we do want to have a safe RAID driver ...
10435-
*/
10436-
if (need_delay)
10437-
msleep(1000);
10438-
1043910429
return NOTIFY_DONE;
1044010430
}
1044110431

drivers/md/raid0.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
6868
struct strip_zone *zone;
6969
int cnt;
7070
struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL);
71-
unsigned int blksize = queue_logical_block_size(mddev->gendisk->queue);
71+
unsigned int blksize = 512;
72+
73+
if (!mddev_is_dm(mddev))
74+
blksize = queue_logical_block_size(mddev->gendisk->queue);
7275

7376
*private_conf = ERR_PTR(-ENOMEM);
7477
if (!conf)
@@ -84,6 +87,10 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
8487
sector_div(sectors, mddev->chunk_sectors);
8588
rdev1->sectors = sectors * mddev->chunk_sectors;
8689

90+
if (mddev_is_dm(mddev))
91+
blksize = max(blksize, queue_logical_block_size(
92+
rdev1->bdev->bd_disk->queue));
93+
8794
rdev_for_each(rdev2, mddev) {
8895
pr_debug("md/raid0:%s: comparing %pg(%llu)"
8996
" with %pg(%llu)\n",

drivers/md/raid5.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4956,7 +4956,8 @@ static void handle_stripe(struct stripe_head *sh)
49564956
goto finish;
49574957

49584958
if (s.handle_bad_blocks ||
4959-
test_bit(MD_SB_CHANGE_PENDING, &conf->mddev->sb_flags)) {
4959+
(md_is_rdwr(conf->mddev) &&
4960+
test_bit(MD_SB_CHANGE_PENDING, &conf->mddev->sb_flags))) {
49604961
set_bit(STRIPE_HANDLE, &sh->state);
49614962
goto finish;
49624963
}
@@ -6768,7 +6769,8 @@ static void raid5d(struct md_thread *thread)
67686769
int batch_size, released;
67696770
unsigned int offset;
67706771

6771-
if (test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags))
6772+
if (md_is_rdwr(mddev) &&
6773+
test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags))
67726774
break;
67736775

67746776
released = release_stripe_list(conf, conf->temp_inactive_list);

0 commit comments

Comments
 (0)