diff options
author | Shaohua Li <shli@fb.com> | 2015-10-08 21:54:07 -0700 |
---|---|---|
committer | NeilBrown <neilb@suse.com> | 2015-11-01 13:48:29 +1100 |
commit | c2bb6242ece5a2a0b6bd415c1d58babe83e971a8 (patch) | |
tree | 9851a37565bc5e14d75ad99b7fe0d53b49fb1d7b /drivers/md/raid5.c | |
parent | 4b482044d24f3db2e11607d0a18f64b3a326972d (diff) |
raid5: journal disk can't be removed
raid5-cache uses journal disk rdev->bdev, rdev->mddev in several places.
Don't allow journal disk disappear magically. On the other hand, we do
need to update superblock for other disks to bump up ->events, so next
time journal disk will be identified as stale.
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 216fa3c64287..693c000e739b 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -7128,6 +7128,15 @@ static int raid5_remove_disk(struct mddev *mddev, struct md_rdev *rdev) struct disk_info *p = conf->disks + number; print_raid5_conf(conf); + if (test_bit(Journal, &rdev->flags)) { + /* + * journal disk is not removable, but we need give a chance to + * update superblock of other disks. Otherwise journal disk + * will be considered as 'fresh' + */ + set_bit(MD_CHANGE_DEVS, &mddev->flags); + return -EINVAL; + } if (rdev == p->rdev) rdevp = &p->rdev; else if (rdev == p->replacement) @@ -7190,6 +7199,8 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) int first = 0; int last = conf->raid_disks - 1; + if (test_bit(Journal, &rdev->flags)) + return -EINVAL; if (mddev->recovery_disabled == conf->recovery_disabled) return -EBUSY; |