Skip to contentSkip to conversation

Endian issue assembling arrays

PATCH Doug Nazar 1 participant 1 message Sep 15, 2010 MD RAID

lore
Share & tools
lore

Doug Nazar

author
#0 lore raw

Has anyone had a chance to look at this?

Thanks,
Doug

-------- Original Message --------
Subject: Endian issue assembling arrays
Date: Wed, 28 Jul 2010 16:53:47 -0400
From: Doug Nazar <[email protected]>
To: [email protected]

Came across this while testing some updates to GRUB's RAID support.

Assembling a RAID1 array on a PPC box results in the following warning:

mdadm: device 1 in /dev/md/0 has wrong state in superblock, but /dev/sdb2 seems ok
mdadm: /dev/md/0 has been started with 2

Doug

super1.c +2 -2
@@ -673,10 +673,10 @@
 		int d = info->disk.number;
 		int want;
 		if (info->disk.state == 6)
-			want = __cpu_to_le32(info->disk.raid_disk);
+			want = info->disk.raid_disk;
 		else
 			want = 0xFFFF;
-		if (sb->dev_roles[d] != want) {
+		if (__le16_to_cpu(sb->dev_roles[d]) != want) {
 			sb->dev_roles[d] = want;
 			rv = 1;
 		}