aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-raid.c
diff options
context:
space:
mode:
authorSong Liu <songliubraving@fb.com>2017-11-20 01:17:01 -0500
committerShaohua Li <shli@fb.com>2017-12-11 11:52:34 -0500
commitd5d885fd514fcebc9da5503c88aa0112df7514ef (patch)
tree71cf428b0bba2cf5c1afd32b8a32fc3ab5724708 /drivers/md/dm-raid.c
parent50c4c4e268a2d7a3e58ebb698ac74da0de40ae36 (diff)
md: introduce new personality funciton start()
In do_md_run(), md threads should not wake up until the array is fully initialized in md_run(). However, in raid5_run(), raid5-cache may wake up mddev->thread to flush stripes that need to be written back. This design doesn't break badly right now. But it could lead to bad bug in the future. This patch tries to resolve this problem by splitting start up work into two personality functions, run() and start(). Tasks that do not require the md threads should go into run(), while task that require the md threads go into start(). r5l_load_log() is moved to raid5_start(), so it is not called until the md threads are started in do_md_run(). Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/dm-raid.c')
-rw-r--r--drivers/md/dm-raid.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 6319d846e0ad..e5ef0757fe23 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -3151,6 +3151,14 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
3151 goto bad; 3151 goto bad;
3152 } 3152 }
3153 3153
3154 r = md_start(&rs->md);
3155
3156 if (r) {
3157 ti->error = "Failed to start raid array";
3158 mddev_unlock(&rs->md);
3159 goto bad_md_start;
3160 }
3161
3154 rs->callbacks.congested_fn = raid_is_congested; 3162 rs->callbacks.congested_fn = raid_is_congested;
3155 dm_table_add_target_callbacks(ti->table, &rs->callbacks); 3163 dm_table_add_target_callbacks(ti->table, &rs->callbacks);
3156 3164
@@ -3198,6 +3206,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
3198 mddev_unlock(&rs->md); 3206 mddev_unlock(&rs->md);
3199 return 0; 3207 return 0;
3200 3208
3209bad_md_start:
3201bad_journal_mode_set: 3210bad_journal_mode_set:
3202bad_stripe_cache: 3211bad_stripe_cache:
3203bad_check_reshape: 3212bad_check_reshape: