Skip to content

Commit

Permalink
Candidate patch as provided by Yu Kuai, adapted from latest mainline
Browse files Browse the repository at this point in the history
  • Loading branch information
ctheune committed Nov 5, 2024
1 parent 6ef5604 commit f963a79
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -4040,6 +4040,7 @@ static void handle_stripe_clean_event(struct r5conf *conf,
test_bit(R5_SkipCopy, &dev->flags))) {
/* We can return any write requests */
struct bio *wbi, *wbi2;
bool written;
pr_debug("Return write for disc %d\n", i);
if (test_and_clear_bit(R5_Discard, &dev->flags))
clear_bit(R5_UPTODATE, &dev->flags);
Expand All @@ -4049,17 +4050,21 @@ static void handle_stripe_clean_event(struct r5conf *conf,
do_endio = true;

returnbi:
written = false;
dev->page = dev->orig_page;
wbi = dev->written;
dev->written = NULL;
if (wbi)
written = true;
while (wbi && wbi->bi_iter.bi_sector <
dev->sector + RAID5_STRIPE_SECTORS(conf)) {
wbi2 = r5_next_bio(conf, wbi, dev->sector);
md_write_end(conf->mddev);
bio_endio(wbi);
wbi = wbi2;
}
md_bitmap_endwrite(conf->mddev->bitmap, sh->sector,
if (written)
md_bitmap_endwrite(conf->mddev->bitmap, sh->sector,
RAID5_STRIPE_SECTORS(conf),
!test_bit(STRIPE_DEGRADED, &sh->state),
0);
Expand Down

0 comments on commit f963a79

Please sign in to comment.