Skip to content

Commit

Permalink
raid5-cache: correct condition for empty metadata write
Browse files Browse the repository at this point in the history
As long as we recover one metadata block, we should write the empty metadata
write. The original code could make recovery corrupted if only one meta is
valid.

Reported-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
Signed-off-by: Shaohua Li <shli@fb.com>
  • Loading branch information
Shaohua Li committed Oct 29, 2016
1 parent 16f8894 commit 9a8b27f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/raid5-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ static int r5l_recovery_log(struct r5l_log *log)
* 1's seq + 10 and let superblock points to meta2. The same recovery will
* not think meta 3 is a valid meta, because its seq doesn't match
*/
if (ctx.seq > log->last_cp_seq + 1) {
if (ctx.seq > log->last_cp_seq) {
int ret;

ret = r5l_log_write_empty_meta_block(log, ctx.pos, ctx.seq + 10);
Expand Down

0 comments on commit 9a8b27f

Please sign in to comment.