[PATCH 3/4] imsm: avoid double change of serial number of missing device

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

 



If degraded state is set in OROM, it do not set 'failed' flag for missing,
device, just changes serial number, sets scsiId to 0xffff and sets highest
bit in ord table in map. When mdadm replaces missing disk, the one left
there is marked as failed and missing again (changing already marked serial
number).

Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@xxxxxxxxx>
---
 super-intel.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index f843997..b361b72 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -6908,12 +6908,15 @@ static int mark_failure(struct imsm_dev *dev, struct imsm_disk *disk, int idx)
 	if (is_failed(disk) && (ord & IMSM_ORD_REBUILD))
 		return 0;
 
-	memcpy(buf, disk->serial, MAX_RAID_SERIAL_LEN);
-	buf[MAX_RAID_SERIAL_LEN] = '\000';
-	strcat(buf, ":0");
-	if ((len = strlen(buf)) >= MAX_RAID_SERIAL_LEN)
-		shift = len - MAX_RAID_SERIAL_LEN + 1;
-	strncpy((char *)disk->serial, &buf[shift], MAX_RAID_SERIAL_LEN);
+	/* do not add ":0", OROM has already done it */
+	if (!(ord & IMSM_ORD_REBUILD)) {
+		memcpy(buf, disk->serial, MAX_RAID_SERIAL_LEN);
+		buf[MAX_RAID_SERIAL_LEN] = '\000';
+		strcat(buf, ":0");
+		if ((len = strlen(buf)) >= MAX_RAID_SERIAL_LEN)
+			shift = len - MAX_RAID_SERIAL_LEN + 1;
+		strncpy((char *)disk->serial, &buf[shift], MAX_RAID_SERIAL_LEN);
+	}
 
 	disk->status |= FAILED_DISK;
 	set_imsm_ord_tbl_ent(map, slot, idx | IMSM_ORD_REBUILD);

--
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