diff options
author | Zhengyuan Liu <liuzhengyuan@kylinos.cn> | 2016-12-04 03:49:44 -0500 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2016-12-05 20:11:02 -0500 |
commit | 3d7e7e1d9db048bc6c1503bca9c82193450fc476 (patch) | |
tree | a9f0729aae90a6974822263329fac7e33e6f7852 | |
parent | 43b9674832cc41ad0ad7b7e2ec397e47dcd5f6c3 (diff) |
md/r5cache: do r5c_update_log_state after log recovery
We should update log state after we did a log recovery, current completion
may get wrong log state since log->log_start wasn't initalized until we
called r5l_recovery_log.
At log recovery stage, no lock needed as there is no race conditon.
next_checkpoint field will be initialized in r5l_recovery_log too.
Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
Signed-off-by: Shaohua Li <shli@fb.com>
-rw-r--r-- | drivers/md/raid5-cache.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 5efb876a588d..c3b3124e033b 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c | |||
@@ -2542,14 +2542,12 @@ create: | |||
2542 | if (log->max_free_space > RECLAIM_MAX_FREE_SPACE) | 2542 | if (log->max_free_space > RECLAIM_MAX_FREE_SPACE) |
2543 | log->max_free_space = RECLAIM_MAX_FREE_SPACE; | 2543 | log->max_free_space = RECLAIM_MAX_FREE_SPACE; |
2544 | log->last_checkpoint = cp; | 2544 | log->last_checkpoint = cp; |
2545 | log->next_checkpoint = cp; | ||
2546 | mutex_lock(&log->io_mutex); | ||
2547 | r5c_update_log_state(log); | ||
2548 | mutex_unlock(&log->io_mutex); | ||
2549 | 2545 | ||
2550 | __free_page(page); | 2546 | __free_page(page); |
2551 | 2547 | ||
2552 | return r5l_recovery_log(log); | 2548 | ret = r5l_recovery_log(log); |
2549 | r5c_update_log_state(log); | ||
2550 | return ret; | ||
2553 | ioerr: | 2551 | ioerr: |
2554 | __free_page(page); | 2552 | __free_page(page); |
2555 | return ret; | 2553 | return ret; |