Skip to content

Commit

Permalink
raid5-cache: start raid5 readonly if journal is missing
Browse files Browse the repository at this point in the history
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: Shaohua Li <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
  • Loading branch information
shligit authored and NeilBrown committed Nov 1, 2015
1 parent a97b789 commit 7dde2ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/raid5-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,9 @@ void r5l_quiesce(struct r5l_log *log, int state)

bool r5l_log_disk_error(struct r5conf *conf)
{
/* don't allow write if journal disk is missing */
if (!conf->log)
return false;
return test_bit(MD_HAS_JOURNAL, &conf->mddev->flags);
return test_bit(Faulty, &conf->log->rdev->flags);
}

Expand Down
7 changes: 7 additions & 0 deletions drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -6810,6 +6810,13 @@ static int run(struct mddev *mddev)
if (IS_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;
mddev->thread = conf->thread;
conf->thread = NULL;
Expand Down

0 comments on commit 7dde2ad

Please sign in to comment.