Skip to content

Commit c9020e6

Browse files
committed
md/raid5-cache: clear MD_SB_CHANGE_PENDING before flushing stripes
In recovery, if we process too much data, raid5-cache may set MD_SB_CHANGE_PENDING, which causes spinning in handle_stripe(). Fix this issue by clearing the bit before flushing data only stripes. This issue was initially discussed in [1]. [1] https://www.spinics.net/lists/raid/msg64409.html Signed-off-by: Song Liu <songliubraving@fb.com>
1 parent e1a86db commit c9020e6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎drivers/md/raid5-cache.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,10 +2430,15 @@ static void r5c_recovery_flush_data_only_stripes(struct r5l_log *log,
24302430
struct mddev *mddev = log->rdev->mddev;
24312431
struct r5conf *conf = mddev->private;
24322432
struct stripe_head *sh, *next;
2433+
bool cleared_pending = false;
24332434

24342435
if (ctx->data_only_stripes == 0)
24352436
return;
24362437

2438+
if (test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)) {
2439+
cleared_pending = true;
2440+
clear_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags);
2441+
}
24372442
log->r5c_journal_mode = R5C_JOURNAL_MODE_WRITE_BACK;
24382443

24392444
list_for_each_entry_safe(sh, next, &ctx->cached_list, lru) {
@@ -2448,6 +2453,8 @@ static void r5c_recovery_flush_data_only_stripes(struct r5l_log *log,
24482453
atomic_read(&conf->active_stripes) == 0);
24492454

24502455
log->r5c_journal_mode = R5C_JOURNAL_MODE_WRITE_THROUGH;
2456+
if (cleared_pending)
2457+
set_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags);
24512458
}
24522459

24532460
static int r5l_recovery_log(struct r5l_log *log)

0 commit comments

Comments
 (0)