mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
md/r5cache: assign conf->log before r5l_load_log()
r5l_load_log() calls functions that requires a proper conf->log, for example, r5c_is_writeback(). Therefore, we should set conf->log before calling r5l_load_log(). If r5l_load_log() fails, conf->log is set back to NULL. Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com>
This commit is contained in:
parent
3c66abbaaf
commit
d2250f105f
1 changed files with 3 additions and 1 deletions
|
@ -2633,14 +2633,16 @@ int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev)
|
||||||
spin_lock_init(&log->stripe_in_journal_lock);
|
spin_lock_init(&log->stripe_in_journal_lock);
|
||||||
atomic_set(&log->stripe_in_journal_count, 0);
|
atomic_set(&log->stripe_in_journal_count, 0);
|
||||||
|
|
||||||
|
rcu_assign_pointer(conf->log, log);
|
||||||
|
|
||||||
if (r5l_load_log(log))
|
if (r5l_load_log(log))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
rcu_assign_pointer(conf->log, log);
|
|
||||||
set_bit(MD_HAS_JOURNAL, &conf->mddev->flags);
|
set_bit(MD_HAS_JOURNAL, &conf->mddev->flags);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
rcu_assign_pointer(conf->log, NULL);
|
||||||
md_unregister_thread(&log->reclaim_thread);
|
md_unregister_thread(&log->reclaim_thread);
|
||||||
reclaim_thread:
|
reclaim_thread:
|
||||||
mempool_destroy(log->meta_pool);
|
mempool_destroy(log->meta_pool);
|
||||||
|
|
Loading…
Add table
Reference in a new issue