Skip to content

Commit 28cd88e

Browse files
Zhengyuan Liushligit
authored andcommitted
md/raid5: initialize next_checkpoint field before use
No initial operation was done to this field when we load/recovery the log, it got assignment only when IO to raid disk was finished. So r5l_quiesce may use wrong next_checkpoint to reclaim log space, that would make reclaimable space calculation confused. Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn> Signed-off-by: Shaohua Li <shli@fb.com>
1 parent 579ed34 commit 28cd88e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/md/raid5-cache.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,8 @@ static int r5l_recovery_log(struct r5l_log *log)
10961096
log->seq = ctx.seq + 11;
10971097
log->log_start = r5l_ring_add(log, ctx.pos, BLOCK_SECTORS);
10981098
r5l_write_super(log, ctx.pos);
1099+
log->last_checkpoint = ctx.pos;
1100+
log->next_checkpoint = ctx.pos;
10991101
} else {
11001102
log->log_start = ctx.pos;
11011103
log->seq = ctx.seq;
@@ -1168,6 +1170,7 @@ static int r5l_load_log(struct r5l_log *log)
11681170
if (log->max_free_space > RECLAIM_MAX_FREE_SPACE)
11691171
log->max_free_space = RECLAIM_MAX_FREE_SPACE;
11701172
log->last_checkpoint = cp;
1173+
log->next_checkpoint = cp;
11711174

11721175
__free_page(page);
11731176

0 commit comments

Comments
 (0)