Skip to content

Commit 486b0f7

Browse files
liu-song-6shligit
authored andcommitted
r5cache: set MD_JOURNAL_CLEAN correctly
Currently, the code sets MD_JOURNAL_CLEAN when the array has MD_FEATURE_JOURNAL and the recovery_cp is MaxSector. The array will be MD_JOURNAL_CLEAN even if the journal device is missing. With this patch, the MD_JOURNAL_CLEAN is only set when the journal device presents. Signed-off-by: Song Liu <[email protected]> Signed-off-by: Shaohua Li <[email protected]>
1 parent c622ca5 commit 486b0f7

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

drivers/md/md.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,11 +1604,8 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
16041604
mddev->new_chunk_sectors = mddev->chunk_sectors;
16051605
}
16061606

1607-
if (le32_to_cpu(sb->feature_map) & MD_FEATURE_JOURNAL) {
1607+
if (le32_to_cpu(sb->feature_map) & MD_FEATURE_JOURNAL)
16081608
set_bit(MD_HAS_JOURNAL, &mddev->flags);
1609-
if (mddev->recovery_cp == MaxSector)
1610-
set_bit(MD_JOURNAL_CLEAN, &mddev->flags);
1611-
}
16121609
} else if (mddev->pers == NULL) {
16131610
/* Insist of good event counter while assembling, except for
16141611
* spares (which don't need an event count) */

drivers/md/raid5.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6840,11 +6840,14 @@ static int raid5_run(struct mddev *mddev)
68406840
if (IS_ERR(conf))
68416841
return PTR_ERR(conf);
68426842

6843-
if (test_bit(MD_HAS_JOURNAL, &mddev->flags) && !journal_dev) {
6844-
printk(KERN_ERR "md/raid:%s: journal disk is missing, force array readonly\n",
6845-
mdname(mddev));
6846-
mddev->ro = 1;
6847-
set_disk_ro(mddev->gendisk, 1);
6843+
if (test_bit(MD_HAS_JOURNAL, &mddev->flags)) {
6844+
if (!journal_dev) {
6845+
pr_err("md/raid:%s: journal disk is missing, force array readonly\n",
6846+
mdname(mddev));
6847+
mddev->ro = 1;
6848+
set_disk_ro(mddev->gendisk, 1);
6849+
} else if (mddev->recovery_cp == MaxSector)
6850+
set_bit(MD_JOURNAL_CLEAN, &mddev->flags);
68486851
}
68496852

68506853
conf->min_offset_diff = min_offset_diff;

0 commit comments

Comments
 (0)