[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181119162640.358782061@linuxfoundation.org>
Date: Mon, 19 Nov 2018 17:28:54 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, kernel test robot <rong.a.chen@...el.com>,
Gioh Kim <gi-oh.kim@...fitbricks.com>,
Guoqing Jiang <gqjiang@...e.com>, Shaohua Li <shli@...com>
Subject: [PATCH 4.4 095/160] MD: fix invalid stored role for a disk - try2
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shaohua Li <shli@...com>
commit 9e753ba9b9b405e3902d9f08aec5f2ea58a0c317 upstream.
Commit d595567dc4f0 (MD: fix invalid stored role for a disk) broke linear
hotadd. Let's only fix the role for disks in raid1/10.
Based on Guoqing's original patch.
Reported-by: kernel test robot <rong.a.chen@...el.com>
Cc: Gioh Kim <gi-oh.kim@...fitbricks.com>
Cc: Guoqing Jiang <gqjiang@...e.com>
Signed-off-by: Shaohua Li <shli@...com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/md/md.c | 4 ----
drivers/md/raid1.c | 1 +
drivers/md/raid10.c | 1 +
3 files changed, 2 insertions(+), 4 deletions(-)
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1670,10 +1670,6 @@ static int super_1_validate(struct mddev
} else
set_bit(In_sync, &rdev->flags);
rdev->raid_disk = role;
- if (role >= mddev->raid_disks) {
- rdev->saved_raid_disk = -1;
- rdev->raid_disk = -1;
- }
break;
}
if (sb->devflags & WriteMostly1)
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1605,6 +1605,7 @@ static int raid1_add_disk(struct mddev *
*/
if (rdev->saved_raid_disk >= 0 &&
rdev->saved_raid_disk >= first &&
+ rdev->saved_raid_disk < conf->raid_disks &&
conf->mirrors[rdev->saved_raid_disk].rdev == NULL)
first = last = rdev->saved_raid_disk;
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1737,6 +1737,7 @@ static int raid10_add_disk(struct mddev
first = last = rdev->raid_disk;
if (rdev->saved_raid_disk >= first &&
+ rdev->saved_raid_disk < conf->geo.raid_disks &&
conf->mirrors[rdev->saved_raid_disk].rdev == NULL)
mirror = rdev->saved_raid_disk;
else
Powered by blists - more mailing lists