linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 0001-md-FIX-raid5-should-accept-slot-set-by-mdadm
@ 2011-01-12 14:49 Kwolek, Adam
  2011-01-12 21:41 ` 0001-md-FIX-raid5-should-accept-slot-set-by-mdadm NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Kwolek, Adam @ 2011-01-12 14:49 UTC (permalink / raw)
  To: neilb@suse.de
  Cc: linux-raid@vger.kernel.org, Williams, Dan J, Ciechanowski, Ed,
	Neubauer, Wojciech

When reshape process is invoked in mdadm, new disks are added with set slot information.
raid5_start_reshape() should count devices with slot set as spares when slot is set outside array.
Those disks has to be added to array for reshape process also.

Changes allows to accept spares with slot set to raid5 configuration.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
---
 drivers/md/raid5.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index dc574f3..fa2b085 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5528,8 +5528,9 @@ static int raid5_start_reshape(mddev_t *mddev)
 		return -ENOSPC;
 
 	list_for_each_entry(rdev, &mddev->disks, same_set)
-		if (rdev->raid_disk < 0 &&
-		    !test_bit(Faulty, &rdev->flags))
+		if (((rdev->raid_disk < 0) ||
+		    ((mddev->raid_disks -1 -mddev->degraded) < rdev->raid_disk)) &&
+		      !test_bit(Faulty, &rdev->flags))
 			spares++;
 
 	if (spares - mddev->degraded < mddev->delta_disks - conf->max_degraded)
@@ -5574,8 +5575,9 @@ static int raid5_start_reshape(mddev_t *mddev)
 	 */
 	if (mddev->delta_disks >= 0)
 	    list_for_each_entry(rdev, &mddev->disks, same_set)
-		if (rdev->raid_disk < 0 &&
-		    !test_bit(Faulty, &rdev->flags)) {
+		if (((rdev->raid_disk < 0) ||
+		    ((mddev->raid_disks -1 -mddev->degraded) < rdev->raid_disk)) &&
+		      !test_bit(Faulty, &rdev->flags)) {
 			if (raid5_add_disk(mddev, rdev) == 0) {
 				char nm[20];
 				if (rdev->raid_disk >= conf->previous_raid_disks) {
-- 
1.6.0.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-12 21:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-12 14:49 0001-md-FIX-raid5-should-accept-slot-set-by-mdadm Kwolek, Adam
2011-01-12 21:41 ` 0001-md-FIX-raid5-should-accept-slot-set-by-mdadm NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).