Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1501855 > unrolled thread

[PATCH] partitions/efi: Ignore errors when alternate GPT is not at the end of disk

Started byHannes Reinecke <hare@suse.de>
First post2016-10-17 12:30 +0200
Last post2016-10-18 12:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] partitions/efi: Ignore errors when alternate GPT is not at the end of disk Hannes Reinecke <hare@suse.de> - 2016-10-17 12:30 +0200
    Re: [PATCH] partitions/efi: Ignore errors when alternate GPT is not  at the end of disk Karel Zak <kzak@redhat.com> - 2016-10-18 12:00 +0200
      Re: [PATCH] partitions/efi: Ignore errors when alternate GPT is not  at the end of disk Hannes Reinecke <hare@suse.com> - 2016-10-18 12:10 +0200

#1501855 — [PATCH] partitions/efi: Ignore errors when alternate GPT is not at the end of disk

FromHannes Reinecke <hare@suse.de>
Date2016-10-17 12:30 +0200
Subject[PATCH] partitions/efi: Ignore errors when alternate GPT is not at the end of disk
Message-ID<stdl7-2ek-1@gated-at.bofh.it>
The GPT specification requires that the alternate GPT is at the
end of the disk. However, if a Software RAID1 is enabled the RAID
metadata typically placed at the end of the disk, and the actual
size of the disk is decreased by the size of the metadata.
Plus it's perfectly legit to have a partition table which is
_smaller_ than the device; eg we don't check for the device
size in the msdos partition, neither.
So don't print out a warning here.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 block/partitions/efi.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index bcd86e5..011faa7 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -550,21 +550,6 @@ static int is_gpt_valid(struct parsed_partitions *state, u64 lba,
 		       le32_to_cpu(agpt->partition_entry_array_crc32));
 		error_found++;
 	}
-	if (le64_to_cpu(pgpt->alternate_lba) != lastlba) {
-		pr_warn("GPT:Primary header thinks Alt. header is not at the end of the disk.\n");
-		pr_warn("GPT:%lld != %lld\n",
-			(unsigned long long)le64_to_cpu(pgpt->alternate_lba),
-			(unsigned long long)lastlba);
-		error_found++;
-	}
-
-	if (le64_to_cpu(agpt->my_lba) != lastlba) {
-		pr_warn("GPT:Alternate GPT header not at the end of the disk.\n");
-		pr_warn("GPT:%lld != %lld\n",
-			(unsigned long long)le64_to_cpu(agpt->my_lba),
-			(unsigned long long)lastlba);
-		error_found++;
-	}
 
 	if (error_found)
 		pr_warn("GPT: Use GNU Parted to correct GPT errors.\n");
-- 
1.8.5.6

[toc] | [next] | [standalone]


#1502850 — Re: [PATCH] partitions/efi: Ignore errors when alternate GPT is not at the end of disk

FromKarel Zak <kzak@redhat.com>
Date2016-10-18 12:00 +0200
SubjectRe: [PATCH] partitions/efi: Ignore errors when alternate GPT is not at the end of disk
Message-ID<stzlD-8kr-3@gated-at.bofh.it>
In reply to#1501855
On Mon, Oct 17, 2016 at 12:20:30PM +0200, Hannes Reinecke wrote:
> The GPT specification requires that the alternate GPT is at the
> end of the disk. However, if a Software RAID1 is enabled the RAID
> metadata typically placed at the end of the disk, and the actual
> size of the disk is decreased by the size of the metadata.

This is not about GPT, but about kernel. It does not support this
use-case and it parses PT on wrong device. If I good remember udev
should be smart enough to remove (by partx) such partitions and 
re-create on /dev/mdX. 

The real solution is to use RAID1 signatures on the begin of the disk.
This problem is generic, not specific to GPT.

> Plus it's perfectly legit to have a partition table which is
> _smaller_ than the device

Well, this is reason why GPT differentiate between headers position
and usable area (addressed by {First,Last}UsableLba within the header.

> eg we don't check for the device
> size in the msdos partition, neither.

All the "backup" GPT stuff is based on well known place for the backup
header. How do you want to reliably support GPT recovery from the
backup header if there is no explicit place for the header? 

Let's imagine your primary header is broken and alternate_lba is
unreliable (or zero, etc.), where is the backup header?

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

[toc] | [prev] | [next] | [standalone]


#1502864 — Re: [PATCH] partitions/efi: Ignore errors when alternate GPT is not at the end of disk

FromHannes Reinecke <hare@suse.com>
Date2016-10-18 12:10 +0200
SubjectRe: [PATCH] partitions/efi: Ignore errors when alternate GPT is not at the end of disk
Message-ID<stzvk-ck-43@gated-at.bofh.it>
In reply to#1502850
On 10/18/2016 11:56 AM, Karel Zak wrote:
> On Mon, Oct 17, 2016 at 12:20:30PM +0200, Hannes Reinecke wrote:
>> The GPT specification requires that the alternate GPT is at the
>> end of the disk. However, if a Software RAID1 is enabled the RAID
>> metadata typically placed at the end of the disk, and the actual
>> size of the disk is decreased by the size of the metadata.
> 
> This is not about GPT, but about kernel. It does not support this
> use-case and it parses PT on wrong device. If I good remember udev
> should be smart enough to remove (by partx) such partitions and 
> re-create on /dev/mdX. 
> 
And introducing a nice race condition when doing so.
Yes, I've noticed :-(

> The real solution is to use RAID1 signatures on the begin of the disk.
> This problem is generic, not specific to GPT.
> 
I would if I had a choice.

To quote SNIA DDF:

'The Anchor Header for the DDF structure MUST be stored on the last
logical block returned by either the ATA Identify Device or SCSI Read
Capacity commands depending on the type of physical disk.'

Emphasis is from the document.

>> Plus it's perfectly legit to have a partition table which is
>> _smaller_ than the device
> 
> Well, this is reason why GPT differentiate between headers position
> and usable area (addressed by {First,Last}UsableLba within the header.
> 
>> eg we don't check for the device
>> size in the msdos partition, neither.
> 
> All the "backup" GPT stuff is based on well known place for the backup
> header. How do you want to reliably support GPT recovery from the
> backup header if there is no explicit place for the header? 
> 
> Let's imagine your primary header is broken and alternate_lba is
> unreliable (or zero, etc.), where is the backup header?
> 
Sure, if things are broken we have to back off.

But if things are not broken (as is the case here), and the GPT is just
formatted for a smaller disk, why do we care?
Or, to put it the other way round:
Why do we care for GPT but not for msdos?

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.com			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web