Skip to content

Commit 713db70

Browse files
committed
Merge tag 'md-7.1-20260323' of git://git.kernel.org/pub/scm/linux/kernel/git/mdraid/linux into for-7.1/block
Pull MD changes from Yu Kuia: "Bug Fixes: - md: suppress spurious superblock update error message for dm-raid (Chen Cheng) - md/raid1: fix the comparing region of interval tree (Xiao Ni) - md/raid10: fix deadlock with check operation and nowait requests (Josh Hunt) - md/raid5: skip 2-failure compute when other disk is R5_LOCKED (FengWei Shih) - md/md-llbitmap: raise barrier before state machine transition (Yu Kuai) - md/md-llbitmap: skip reading rdevs that are not in_sync (Yu Kuai) Improvements: - md/raid5: set chunk_sectors to enable full stripe I/O splitting (Yu Kuai) Cleanups: - md: remove unused mddev argument from export_rdev (Chen Cheng) - md/raid5: remove stale md_raid5_kick_device() declaration (Chen Cheng) - md/raid5: move handle_stripe() comment to correct location (Chen Cheng)" * tag 'md-7.1-20260323' of git://git.kernel.org/pub/scm/linux/kernel/git/mdraid/linux: md: remove unused mddev argument from export_rdev md/raid5: move handle_stripe() comment to correct location md/raid5: remove stale md_raid5_kick_device() declaration md/raid1: fix the comparing region of interval tree md/raid5: skip 2-failure compute when other disk is R5_LOCKED md/md-llbitmap: raise barrier before state machine transition md/md-llbitmap: skip reading rdevs that are not in_sync md/raid5: set chunk_sectors to enable full stripe I/O splitting md/raid10: fix deadlock with check operation and nowait requests md: suppress spurious superblock update error message for dm-raid
2 parents c2d466b + 6f507eb commit 713db70

6 files changed

Lines changed: 42 additions & 39 deletions

File tree

drivers/md/md-llbitmap.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,8 @@ static struct page *llbitmap_read_page(struct llbitmap *llbitmap, int idx)
459459
rdev_for_each(rdev, mddev) {
460460
sector_t sector;
461461

462-
if (rdev->raid_disk < 0 || test_bit(Faulty, &rdev->flags))
462+
if (rdev->raid_disk < 0 || test_bit(Faulty, &rdev->flags) ||
463+
!test_bit(In_sync, &rdev->flags))
463464
continue;
464465

465466
sector = mddev->bitmap_info.offset +
@@ -1069,12 +1070,12 @@ static void llbitmap_start_write(struct mddev *mddev, sector_t offset,
10691070
int page_start = (start + BITMAP_DATA_OFFSET) >> PAGE_SHIFT;
10701071
int page_end = (end + BITMAP_DATA_OFFSET) >> PAGE_SHIFT;
10711072

1072-
llbitmap_state_machine(llbitmap, start, end, BitmapActionStartwrite);
1073-
10741073
while (page_start <= page_end) {
10751074
llbitmap_raise_barrier(llbitmap, page_start);
10761075
page_start++;
10771076
}
1077+
1078+
llbitmap_state_machine(llbitmap, start, end, BitmapActionStartwrite);
10781079
}
10791080

10801081
static void llbitmap_end_write(struct mddev *mddev, sector_t offset,
@@ -1101,12 +1102,12 @@ static void llbitmap_start_discard(struct mddev *mddev, sector_t offset,
11011102
int page_start = (start + BITMAP_DATA_OFFSET) >> PAGE_SHIFT;
11021103
int page_end = (end + BITMAP_DATA_OFFSET) >> PAGE_SHIFT;
11031104

1104-
llbitmap_state_machine(llbitmap, start, end, BitmapActionDiscard);
1105-
11061105
while (page_start <= page_end) {
11071106
llbitmap_raise_barrier(llbitmap, page_start);
11081107
page_start++;
11091108
}
1109+
1110+
llbitmap_state_machine(llbitmap, start, end, BitmapActionDiscard);
11101111
}
11111112

11121113
static void llbitmap_end_discard(struct mddev *mddev, sector_t offset,

drivers/md/md.c

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static struct workqueue_struct *md_misc_wq;
9898
static int remove_and_add_spares(struct mddev *mddev,
9999
struct md_rdev *this);
100100
static void mddev_detach(struct mddev *mddev);
101-
static void export_rdev(struct md_rdev *rdev, struct mddev *mddev);
101+
static void export_rdev(struct md_rdev *rdev);
102102
static void md_wakeup_thread_directly(struct md_thread __rcu **thread);
103103

104104
/*
@@ -959,7 +959,7 @@ void mddev_unlock(struct mddev *mddev)
959959
list_for_each_entry_safe(rdev, tmp, &delete, same_set) {
960960
list_del_init(&rdev->same_set);
961961
kobject_del(&rdev->kobj);
962-
export_rdev(rdev, mddev);
962+
export_rdev(rdev);
963963
}
964964

965965
if (!legacy_async_del_gendisk) {
@@ -2632,7 +2632,7 @@ void md_autodetect_dev(dev_t dev);
26322632
/* just for claiming the bdev */
26332633
static struct md_rdev claim_rdev;
26342634

2635-
static void export_rdev(struct md_rdev *rdev, struct mddev *mddev)
2635+
static void export_rdev(struct md_rdev *rdev)
26362636
{
26372637
pr_debug("md: export_rdev(%pg)\n", rdev->bdev);
26382638
md_rdev_clear(rdev);
@@ -2788,7 +2788,9 @@ 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));
2791+
if (!mddev_is_dm(mddev))
2792+
pr_err_ratelimited("%s: can't update sb for read-only array %s\n",
2793+
__func__, mdname(mddev));
27922794
return;
27932795
}
27942796

@@ -4848,7 +4850,7 @@ new_dev_store(struct mddev *mddev, const char *buf, size_t len)
48484850
err = bind_rdev_to_array(rdev, mddev);
48494851
out:
48504852
if (err)
4851-
export_rdev(rdev, mddev);
4853+
export_rdev(rdev);
48524854
mddev_unlock_and_resume(mddev);
48534855
if (!err)
48544856
md_new_event();
@@ -7140,7 +7142,7 @@ static void autorun_devices(int part)
71407142
rdev_for_each_list(rdev, tmp, &candidates) {
71417143
list_del_init(&rdev->same_set);
71427144
if (bind_rdev_to_array(rdev, mddev))
7143-
export_rdev(rdev, mddev);
7145+
export_rdev(rdev);
71447146
}
71457147
autorun_array(mddev);
71467148
mddev_unlock_and_resume(mddev);
@@ -7150,7 +7152,7 @@ static void autorun_devices(int part)
71507152
*/
71517153
rdev_for_each_list(rdev, tmp, &candidates) {
71527154
list_del_init(&rdev->same_set);
7153-
export_rdev(rdev, mddev);
7155+
export_rdev(rdev);
71547156
}
71557157
mddev_put(mddev);
71567158
}
@@ -7338,13 +7340,13 @@ int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info_s *info)
73387340
pr_warn("md: %pg has different UUID to %pg\n",
73397341
rdev->bdev,
73407342
rdev0->bdev);
7341-
export_rdev(rdev, mddev);
7343+
export_rdev(rdev);
73427344
return -EINVAL;
73437345
}
73447346
}
73457347
err = bind_rdev_to_array(rdev, mddev);
73467348
if (err)
7347-
export_rdev(rdev, mddev);
7349+
export_rdev(rdev);
73487350
return err;
73497351
}
73507352

@@ -7387,7 +7389,7 @@ int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info_s *info)
73877389
/* This was a hot-add request, but events doesn't
73887390
* match, so reject it.
73897391
*/
7390-
export_rdev(rdev, mddev);
7392+
export_rdev(rdev);
73917393
return -EINVAL;
73927394
}
73937395

@@ -7413,7 +7415,7 @@ int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info_s *info)
74137415
}
74147416
}
74157417
if (has_journal || mddev->bitmap) {
7416-
export_rdev(rdev, mddev);
7418+
export_rdev(rdev);
74177419
return -EBUSY;
74187420
}
74197421
set_bit(Journal, &rdev->flags);
@@ -7428,7 +7430,7 @@ int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info_s *info)
74287430
/* --add initiated by this node */
74297431
err = mddev->cluster_ops->add_new_disk(mddev, rdev);
74307432
if (err) {
7431-
export_rdev(rdev, mddev);
7433+
export_rdev(rdev);
74327434
return err;
74337435
}
74347436
}
@@ -7438,7 +7440,7 @@ int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info_s *info)
74387440
err = bind_rdev_to_array(rdev, mddev);
74397441

74407442
if (err)
7441-
export_rdev(rdev, mddev);
7443+
export_rdev(rdev);
74427444

74437445
if (mddev_is_clustered(mddev)) {
74447446
if (info->state & (1 << MD_DISK_CANDIDATE)) {
@@ -7501,7 +7503,7 @@ int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info_s *info)
75017503

75027504
err = bind_rdev_to_array(rdev, mddev);
75037505
if (err) {
7504-
export_rdev(rdev, mddev);
7506+
export_rdev(rdev);
75057507
return err;
75067508
}
75077509
}
@@ -7613,7 +7615,7 @@ static int hot_add_disk(struct mddev *mddev, dev_t dev)
76137615
return 0;
76147616

76157617
abort_export:
7616-
export_rdev(rdev, mddev);
7618+
export_rdev(rdev);
76177619
return err;
76187620
}
76197621

drivers/md/raid1.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static int check_and_add_serial(struct md_rdev *rdev, struct r1bio *r1_bio,
6262
unsigned long flags;
6363
int ret = 0;
6464
sector_t lo = r1_bio->sector;
65-
sector_t hi = lo + r1_bio->sectors;
65+
sector_t hi = lo + r1_bio->sectors - 1;
6666
struct serial_in_rdev *serial = &rdev->serial[idx];
6767

6868
spin_lock_irqsave(&serial->serial_lock, flags);
@@ -452,7 +452,7 @@ static void raid1_end_write_request(struct bio *bio)
452452
int mirror = find_bio_disk(r1_bio, bio);
453453
struct md_rdev *rdev = conf->mirrors[mirror].rdev;
454454
sector_t lo = r1_bio->sector;
455-
sector_t hi = r1_bio->sector + r1_bio->sectors;
455+
sector_t hi = r1_bio->sector + r1_bio->sectors - 1;
456456
bool ignore_error = !raid1_should_handle_error(bio) ||
457457
(bio->bi_status && bio_op(bio) == REQ_OP_DISCARD);
458458

drivers/md/raid10.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
11841184
}
11851185

11861186
if (!regular_request_wait(mddev, conf, bio, r10_bio->sectors)) {
1187-
raid_end_bio_io(r10_bio);
1187+
free_r10bio(r10_bio);
11881188
return;
11891189
}
11901190

@@ -1372,7 +1372,7 @@ static void raid10_write_request(struct mddev *mddev, struct bio *bio,
13721372

13731373
sectors = r10_bio->sectors;
13741374
if (!regular_request_wait(mddev, conf, bio, sectors)) {
1375-
raid_end_bio_io(r10_bio);
1375+
free_r10bio(r10_bio);
13761376
return;
13771377
}
13781378

drivers/md/raid5.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3916,6 +3916,8 @@ static int fetch_block(struct stripe_head *sh, struct stripe_head_state *s,
39163916
break;
39173917
}
39183918
BUG_ON(other < 0);
3919+
if (test_bit(R5_LOCKED, &sh->dev[other].flags))
3920+
return 0;
39193921
pr_debug("Computing stripe %llu blocks %d,%d\n",
39203922
(unsigned long long)sh->sector,
39213923
disk_idx, other);
@@ -4594,20 +4596,6 @@ static void handle_stripe_expansion(struct r5conf *conf, struct stripe_head *sh)
45944596
async_tx_quiesce(&tx);
45954597
}
45964598

4597-
/*
4598-
* handle_stripe - do things to a stripe.
4599-
*
4600-
* We lock the stripe by setting STRIPE_ACTIVE and then examine the
4601-
* state of various bits to see what needs to be done.
4602-
* Possible results:
4603-
* return some read requests which now have data
4604-
* return some write requests which are safely on storage
4605-
* schedule a read on some buffers
4606-
* schedule a write of some buffers
4607-
* return confirmation of parity correctness
4608-
*
4609-
*/
4610-
46114599
static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s)
46124600
{
46134601
struct r5conf *conf = sh->raid_conf;
@@ -4901,6 +4889,18 @@ static void break_stripe_batch_list(struct stripe_head *head_sh,
49014889
set_bit(STRIPE_HANDLE, &head_sh->state);
49024890
}
49034891

4892+
/*
4893+
* handle_stripe - do things to a stripe.
4894+
*
4895+
* We lock the stripe by setting STRIPE_ACTIVE and then examine the
4896+
* state of various bits to see what needs to be done.
4897+
* Possible results:
4898+
* return some read requests which now have data
4899+
* return some write requests which are safely on storage
4900+
* schedule a read on some buffers
4901+
* schedule a write of some buffers
4902+
* return confirmation of parity correctness
4903+
*/
49044904
static void handle_stripe(struct stripe_head *sh)
49054905
{
49064906
struct stripe_head_state s;
@@ -7780,6 +7780,7 @@ static int raid5_set_limits(struct mddev *mddev)
77807780
lim.logical_block_size = mddev->logical_block_size;
77817781
lim.io_min = mddev->chunk_sectors << 9;
77827782
lim.io_opt = lim.io_min * (conf->raid_disks - conf->max_degraded);
7783+
lim.chunk_sectors = lim.io_opt >> 9;
77837784
lim.features |= BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE;
77847785
lim.discard_granularity = stripe;
77857786
lim.max_write_zeroes_sectors = 0;

drivers/md/raid5.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,6 @@ raid5_get_dev_page(struct stripe_head *sh, int disk_idx)
801801
}
802802
#endif
803803

804-
void md_raid5_kick_device(struct r5conf *conf);
805804
int raid5_set_cache_size(struct mddev *mddev, int size);
806805
sector_t raid5_compute_blocknr(struct stripe_head *sh, int i, int previous);
807806
void raid5_release_stripe(struct stripe_head *sh);

0 commit comments

Comments
 (0)