Received: from list by lists.gnu.org with archive (Exim 4.71) id 1cWVfB-0004I4-Fk for mharc-grub-devel@gnu.org; Wed, 25 Jan 2017 17:03:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWVf8-0004H1-Kp for grub-devel@gnu.org; Wed, 25 Jan 2017 17:03:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWVf6-0007Oe-9x for grub-devel@gnu.org; Wed, 25 Jan 2017 17:03:30 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:35274) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cWVf6-0007Lk-4H for grub-devel@gnu.org; Wed, 25 Jan 2017 17:03:28 -0500 Received: by mail-pg0-x244.google.com with SMTP id 204so20721829pge.2 for ; Wed, 25 Jan 2017 14:03:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leblancnet-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=KwDV105mqXLQ0SM4emYc83CPWYR2ASFQsnIGWZjhLBM=; b=koE1O6LmPmscoxMWa9SRaM3rlvTH6Qon75lLeAP1KR/M5YDSPNqfYd+izGfB6KPihz ns0Cf6X0ioeX7A4cbk/YLTgXdbd972X7WirISXY1xhb8fo+rEAhyMa+AqaNvQ0+DAkgb 2mJdsTzFsYFAGEyWML8Jt604DnLe3VXWlGkEImceaV2trncV/cL3FvFUvZvxqmvRBiK6 gKpXfvJYt1Iel+kevkqtofor3a4/XWtWE0pu5L8W1+qA5U8+5iJHF7L0IMVMPhsJxAfy 0UcgAd3QNn3c0cpeFcnpXCjFjacAm/A7TQj5J/duO9pBqowfQAWbyU9KakvzlRoWlriV m0jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=KwDV105mqXLQ0SM4emYc83CPWYR2ASFQsnIGWZjhLBM=; b=bz0PQQQSpyURBswbLFcxx1RwDCVxGKVTmqyrTKiJM3iT1xWaZqsbVnkh1bS3tKeloE N6Dr9YoLTyGhGEiluuC+Pd46NeA7FlUx8lqWk+F3y/54Bz6I8nKkTMv5DXQqovG9Hs+g L6aSJu6d7/Iih0gAmeem7BGb2pC+Tyhfo8rF3AfSvzRKr0HEAM1GhVpgu4ebsZ+OsdFB 7sOUqPMnU0RxSM2GeUv+kFfb/R27HpP1k1swbeHGR862iquA26omEQZcE8sBE5RZ0Ref 1aZDFWJ/fkusxIq1U1QxbequspXfVpS7c6RN0hAQzDw4DpXxb72KbNBBXE9ZC3VY7qiN 7qyQ== X-Gm-Message-State: AIkVDXLjvl4vMVmbhzq+C0s5RHtt+ZycK7qOR6HJbK7IlhNQVLRzDbm6+j4nd/RV9rpTNg== X-Received: by 10.99.163.109 with SMTP id v45mr1657873pgn.39.1485381805271; Wed, 25 Jan 2017 14:03:25 -0800 (PST) Received: from rleblanc-pc ([2604:ba00:2:1:3c8b:b5a9:a00d:771c]) by smtp.gmail.com with ESMTPSA id u29sm3315846pfl.17.2017.01.25.14.03.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Jan 2017 14:03:24 -0800 (PST) Received: from rleblanc by rleblanc-pc with local (Exim 4.88) (envelope-from ) id 1cWVf1-0006Al-O5; Wed, 25 Jan 2017 15:03:23 -0700 From: Robert LeBlanc To: grub-devel@gnu.org Cc: Robert LeBlanc Subject: [PATCH v3] disk/mdraid1x: Fix >2TB RAID detection with BIOS Date: Wed, 25 Jan 2017 15:02:46 -0700 Message-Id: <20170125220246.23651-1-robert@leblancnet.us> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::244 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 22:03:32 -0000 Changes in v3: - Fix to return if not out of range instead of breaking out of the loop. Changes in v2: - Only continue checking for other metadata versions if we get an out of range error and reset grub_errno if we continue. When a mdadm RAID array is on a drive larger than 2TB, the array is not able to be detected and as such even if the array has a partition that holds /boot under the 2TB limit, it is unable to boot the machine. This is caused by metadata 1.0 being tested first which allocates the superblock at the end of the device. When it tries to access the end of the device it throws an error and the code returns without trying to find the superblock at other locations (metadata 1.1 and 1.2). This patch changes the error to not be fatal and allow for the checking for the other metadata versions and allowing the machine to boot as long as /boot is under the 2TB BIOS limit. This won't cause issues with 1.0 metadata because GRUB is able to read the partitions from the front of the drive/partition without having to determine the data offset, since the data for metadata 1.0 starts at sector 0. Signed-off-by: Robert LeBlanc --- grub-core/disk/mdraid1x_linux.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/grub-core/disk/mdraid1x_linux.c b/grub-core/disk/mdraid1x_linux.c index 7cc80d3df..f0aeb6829 100644 --- a/grub-core/disk/mdraid1x_linux.c +++ b/grub-core/disk/mdraid1x_linux.c @@ -148,7 +148,17 @@ grub_mdraid_detect (grub_disk_t disk, if (grub_disk_read (disk, sector, 0, sizeof (struct grub_raid_super_1x), &sb)) - return NULL; + { + if (grub_errno == GRUB_ERR_OUT_OF_RANGE) + { + grub_errno = GRUB_ERR_NONE; + continue; + } + else + { + return NULL; + } + } if (sb.magic != grub_cpu_to_le32_compile_time (SB_MAGIC) || grub_le_to_cpu64 (sb.super_offset) != sector) -- 2.11.0