]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Revert revision 254095
authormarcel <marcel@FreeBSD.org>
Tue, 5 Mar 2019 04:15:34 +0000 (04:15 +0000)
committermarcel <marcel@FreeBSD.org>
Tue, 5 Mar 2019 04:15:34 +0000 (04:15 +0000)
commit6ea99782074626671791c8208926bb173c44f0f5
tree51b1dfb91a49a26f4e2d937882436f64de47f060
parente846d2bb4f384a865d7a936b4f6ba86feca6874e
Revert revision 254095

In revision 254095, gpt_entries is not set to match the on-disk
hdr_entries, but rather is computed based on available space.
There are 2 problems with this:

1.  The GPT backend respects hdr_entries and only reads and writes
    that number of partition entries.  On top of that, CRC32 is
    computed over the table that has hdr_entries elements.  When
    the common code works on what is possibly a larger number, the
    behaviour becomes inconsistent and problematic.  In particular,
    it would be possible to add a new partition that on a reboot
    isn't there anymore.
2.  The calculation of gpt_entries is based on flawed assumptions.
    The GPT specification does not dictate that sectors are layed
    out in a particular way that the available space can be
    determined by looking at LBAs.  In practice, implementations
    do the same thing, because there's no reason to do it any
    other way.  Still, GPT allows certain freedoms that can be
    exploited in some form or shape if the need arises.

PR: 229977
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19438
sys/geom/part/g_part_gpt.c