]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
raid5-cache: correct condition for empty metadata write
authorShaohua Li <shli@fb.com>
Thu, 27 Oct 2016 22:22:13 +0000 (15:22 -0700)
committerShaohua Li <shli@fb.com>
Sat, 29 Oct 2016 05:04:03 +0000 (22:04 -0700)
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>
drivers/md/raid5-cache.c

index 981f85515191e338550e38e66404f91859694ea5..a227a9f3ee6556b1af15223080e791fda7817989 100644 (file)
@@ -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);