Commit 7dde2ad3 authored by Shaohua Li's avatar Shaohua Li Committed by NeilBrown

raid5-cache: start raid5 readonly if journal is missing

If raid array is expected to have journal (eg, journal is set in MD
superblock feature map) and the array is started without journal disk,
start the array readonly.
Signed-off-by: default avatarShaohua Li <shli@fb.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
parent a97b7896
...@@ -806,8 +806,9 @@ void r5l_quiesce(struct r5l_log *log, int state) ...@@ -806,8 +806,9 @@ void r5l_quiesce(struct r5l_log *log, int state)
bool r5l_log_disk_error(struct r5conf *conf) bool r5l_log_disk_error(struct r5conf *conf)
{ {
/* don't allow write if journal disk is missing */
if (!conf->log) if (!conf->log)
return false; return test_bit(MD_HAS_JOURNAL, &conf->mddev->flags);
return test_bit(Faulty, &conf->log->rdev->flags); return test_bit(Faulty, &conf->log->rdev->flags);
} }
......
...@@ -6810,6 +6810,13 @@ static int run(struct mddev *mddev) ...@@ -6810,6 +6810,13 @@ static int run(struct mddev *mddev)
if (IS_ERR(conf)) if (IS_ERR(conf))
return PTR_ERR(conf); return PTR_ERR(conf);
if (test_bit(MD_HAS_JOURNAL, &mddev->flags) && !journal_dev) {
printk(KERN_ERR "md/raid:%s: journal disk is missing, force array readonly\n",
mdname(mddev));
mddev->ro = 1;
set_disk_ro(mddev->gendisk, 1);
}
conf->min_offset_diff = min_offset_diff; conf->min_offset_diff = min_offset_diff;
mddev->thread = conf->thread; mddev->thread = conf->thread;
conf->thread = NULL; conf->thread = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment