summaryrefslogtreecommitdiff
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2015-10-08 21:54:12 -0700
committerNeilBrown <neilb@suse.com>2015-11-01 13:48:29 +1100
commitf2076e7d0643d15b11db979acc7cffd2e8d69e77 (patch)
tree6c0129f2dc73fedcf4be0c168df780f59a5e65df /drivers/md/raid5.c
parenta3dfbdaadba2612faf11f025b8156c36e3700247 (diff)
downloadlwn-f2076e7d0643d15b11db979acc7cffd2e8d69e77.tar.gz
lwn-f2076e7d0643d15b11db979acc7cffd2e8d69e77.zip
MD: set journal disk ->raid_disk
Set journal disk ->raid_disk to >=0, I choose raid_disks + 1 instead of 0, because we already have a disk with ->raid_disk 0 and this causes sysfs entry creation conflict. A lot of places assumes disk with ->raid_disk >=0 is normal raid disk, so we add check for journal disk. 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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index e1d18be67243..e5befa356dbe 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -6560,7 +6560,7 @@ static struct r5conf *setup_conf(struct mddev *mddev)
rdev_for_each(rdev, mddev) {
raid_disk = rdev->raid_disk;
if (raid_disk >= max_disks
- || raid_disk < 0)
+ || raid_disk < 0 || test_bit(Journal, &rdev->flags))
continue;
disk = conf->disks + raid_disk;
@@ -6694,8 +6694,10 @@ static int run(struct mddev *mddev)
rdev_for_each(rdev, mddev) {
long long diff;
- if (test_bit(Journal, &rdev->flags))
+ if (test_bit(Journal, &rdev->flags)) {
journal_dev = rdev;
+ continue;
+ }
if (rdev->raid_disk < 0)
continue;
diff = (rdev->new_data_offset - rdev->data_offset);