Received: from list by lists.gnu.org with archive (Exim 4.71) id 1cWCao-0003Lr-MM for mharc-grub-devel@gnu.org; Tue, 24 Jan 2017 20:41:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWCal-0003ER-RB for grub-devel@gnu.org; Tue, 24 Jan 2017 20:41:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWCal-0004ff-13 for grub-devel@gnu.org; Tue, 24 Jan 2017 20:41:43 -0500 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:35880) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cWCak-0004fb-Qr for grub-devel@gnu.org; Tue, 24 Jan 2017 20:41:42 -0500 Received: by mail-pg0-x243.google.com with SMTP id 75so18045685pgf.3 for ; Tue, 24 Jan 2017 17:41:42 -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=1CuQnJKy3Y14j17ZtD2p+R474MR7BnnzS/PIGs9Iaro=; b=mTzVakxoJgb+zPoPHN/R2tU8PwUTEE7DgabCPx7l3cd66AaoRuRux3t9cSzXmyQ9d4 NUiGtKxPyNeHnOQ2Va/BcdVrBtq+a4AbbGguZSkfLm+qo+9OmQQGeOyUtYCnp8NXX+vt TfPrOuldb/ZrA9FnwIuweO2YdfNNCh1yvwGJNZdltSDBh8UA2PfUenwLnOv1eVqf7W60 aCeHoPs7YuwMMYE8dTfjnm99La1izlPo4RjRwvBBPUBsArF5mxBYAtnrYn5D1LpVOaSA i2p8sHSSEpF5dSz5FXFzGoJXi4GVvhVC1ZlrwxpnCK9DMDUOx06hAGwtCnF3dUpvrEHm q5ug== 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=1CuQnJKy3Y14j17ZtD2p+R474MR7BnnzS/PIGs9Iaro=; b=cbo66afJDgVw35/cHARAAa4mFYXGEkRk9O64dUUuJsjHYSssOCfxVuktlMYMpqtxKi WOZ5lNvRkC43LwARlNGiIM0Bew5Dpip1wAmBbG5IMkgP6wJfUSLb4YmfM9aHsajleUYr L8tWwtoB2J4QfkrCf9D+K7tzHTxxCIj6qXmTe6hN1L3/LfNfFWvmcRRaZcdvTREpDlLa uPaNn5gMVNJVEjW4kAalusX2VFaLRNpbItClNs9XLGK4R1EVmhGGJTFqa3Dbwebrp3YX hnlZQPswagHf0lmfja3ngZh1iZaRg1EmBOArYNblXpLuvFFKjoBBwkyU5r7xgAK9petR np9Q== X-Gm-Message-State: AIkVDXIiurhCxtUONZQdpbwCZ6L2Tp/v0T8fgGSDHAAdsTxleCX4OzXyveI1yoMzD6m4lA== X-Received: by 10.99.104.133 with SMTP id d127mr43473599pgc.52.1485308501482; Tue, 24 Jan 2017 17:41:41 -0800 (PST) Received: from rleblanc-pc ([2604:ba00:2:1:2c01:77a1:10ad:686b]) by smtp.gmail.com with ESMTPSA id y201sm47557026pfb.16.2017.01.24.17.41.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Jan 2017 17:41:40 -0800 (PST) Received: from rleblanc by rleblanc-pc with local (Exim 4.88) (envelope-from ) id 1cWCah-0005nx-Am; Tue, 24 Jan 2017 18:41:39 -0700 From: Robert LeBlanc To: grub-devel@gnu.org Cc: Robert LeBlanc Subject: [PATCH v2] disk/mdraid1x: Fix >2TB RAID detection with BIOS Date: Tue, 24 Jan 2017 18:41:31 -0700 Message-Id: <20170125014131.22265-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::243 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 01:41:45 -0000 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..dfe449a21 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 + { + break; + } + } if (sb.magic != grub_cpu_to_le32_compile_time (SB_MAGIC) || grub_le_to_cpu64 (sb.super_offset) != sector) -- 2.11.0