summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5-cache.c
diff options
context:
space:
mode:
authorSong Liu <songliubraving@fb.com>2016-12-14 15:38:02 -0800
committerShaohua Li <shli@fb.com>2017-01-05 11:44:38 -0800
commitd2250f105f18a43fdab17421bd80b0ffc9fcc53f (patch)
tree78237de8dc0bbec061524097bbf36a741a498f83 /drivers/md/raid5-cache.c
parent3c66abbaaf69671dfd3eb9fa7740b5d7ec688231 (diff)
downloadlinux-stable-d2250f105f18a43fdab17421bd80b0ffc9fcc53f.tar.gz
linux-stable-d2250f105f18a43fdab17421bd80b0ffc9fcc53f.tar.bz2
linux-stable-d2250f105f18a43fdab17421bd80b0ffc9fcc53f.zip
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>
Diffstat (limited to 'drivers/md/raid5-cache.c')
-rw-r--r--drivers/md/raid5-cache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
index b178a8fef266..bff1b4a949e8 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -2633,14 +2633,16 @@ int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev)
spin_lock_init(&log->stripe_in_journal_lock);
atomic_set(&log->stripe_in_journal_count, 0);
+ rcu_assign_pointer(conf->log, log);
+
if (r5l_load_log(log))
goto error;
- rcu_assign_pointer(conf->log, log);
set_bit(MD_HAS_JOURNAL, &conf->mddev->flags);
return 0;
error:
+ rcu_assign_pointer(conf->log, NULL);
md_unregister_thread(&log->reclaim_thread);
reclaim_thread:
mempool_destroy(log->meta_pool);