[PATCH 3/3] md: fix invalid dev slots after takeover

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Maciej Trela <maciej.trela@xxxxxxxxx>

While raid10->raid0 takeover incorrect slot numbers are set for raid0. This was caused by invalidating dev slot numbers before calling pers->run(). We are invalidating all devs that has (rdev->raid_disk >= mddev->raid_disks) but rdev->raid_disk numbers are scaled in pers->run().

Another option to fix the problem:
If invalidating devs should rather be performed before run() we could use devlist[index] for invalidating - devlist is already updated after calling takeover...
---
 drivers/md/md.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c index 46b3a04..effe601 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3052,12 +3052,6 @@ level_store(mddev_t *mddev, const char *buf, size_t len)
 	}
 
 	module_put(mddev->pers->owner);
-	/* Invalidate devices that are now superfluous */
-	list_for_each_entry(rdev, &mddev->disks, same_set)
-		if (rdev->raid_disk >= mddev->raid_disks) {
-			rdev->raid_disk = -1;
-			clear_bit(In_sync, &rdev->flags);
-		}
 	mddev->pers = pers;
 	mddev->private = priv;
 	strlcpy(mddev->clevel, pers->name, sizeof(mddev->clevel)); @@ -3072,7 +3066,15 @@ level_store(mddev_t *mddev, const char *buf, size_t len)
 		mddev->in_sync = 1;
 		del_timer_sync(&mddev->safemode_timer);
 	}
+
 	pers->run(mddev);
+
+	/* Invalidate devices that are now superfluous */
+	list_for_each_entry(rdev, &mddev->disks, same_set)
+		if (rdev->raid_disk >= mddev->raid_disks) {
+			rdev->raid_disk = -1;
+			clear_bit(In_sync, &rdev->flags);
+		}
 	mddev_resume(mddev);
 	set_bit(MD_CHANGE_DEVS, &mddev->flags);
 	set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux