Page MenuHomeFreeBSD

Allow more nesting of GEOM partitioning schemes
ClosedPublic

Authored by andrew_tao173.riddles.org.uk on Aug 21 2019, 1:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 29, 10:28 AM
Unknown Object (File)
Feb 29 2024, 11:16 AM
Unknown Object (File)
Feb 15 2024, 5:43 PM
Unknown Object (File)
Dec 22 2023, 10:46 PM
Unknown Object (File)
Sep 25 2023, 9:53 AM
Unknown Object (File)
Aug 29 2023, 5:28 PM
Unknown Object (File)
Aug 29 2023, 5:23 PM
Unknown Object (File)
Aug 29 2023, 1:44 PM

Details

Summary

GEOM is supposed to be topology-agnostic, but the GPT and BSD partition code has arbitrary restrictions on nesting that are annoying in cases such as running VMs on raw partitions (since the VM's partitioning scheme is not visible to the host).

This patch adds sysctls to disable the restrictions except in the case of BSD label (and similar) partitions with offset 0 (where we need to avoid recursively recognizing the label).

Test Plan

These explicit tests have been completed (testing was done on both amd64 and armv7 platforms):

  1. Verified that the options correctly default to off
  2. Verified that with the options off, the behavior of both partition probing and gpart create is unchanged from before
  3. Verified that the options can be enabled separately and together and that all combinations work as expected
  4. Verified that partitions of offset 0 (or other small offsets) do not cause recursion

I've also been running this code on my dev VM host for a while with no issues.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Nesting is there as a sanity check when you try to create an inner container at offset 0, you don't recurse with the outer container somehow... Does this run afoul of that?

sys/geom/part/g_part_gpt.c
664 ↗(On Diff #61074)

comment update

826 ↗(On Diff #61074)

comment update.

In D21350#464485, @imp wrote:

Nesting is there as a sanity check when you try to create an inner container at offset 0, you don't recurse with the outer container somehow... Does this run afoul of that?

GPT (and MBR/EBR) doesn't allow partitions that include offset 0; as far as I know only BSD allows that.

Hence the logic that preserves the "isleaf" flag (always set by BSD partition geoms) when nesting is enabled but the provider offset is 0. This is sufficient (and tested) to avoid the obvious recursion case, though I haven't checked whether it can be fooled by putting labels at nonstandard positions.

OK. Other than the updating the comments, I'm convinced this is a good thing.

In D21350#464589, @imp wrote:

OK. Other than the updating the comments, I'm convinced this is a good thing.

I'll post a new patch with proper comments and so on when time allows.

Add documentation. Update comments. Refine the wording a little.

andrew_tao173.riddles.org.uk edited the test plan for this revision. (Show Details)

I've been running this myself for a while and have done explicit tests as listed in the test plan, and as far as I'm concerned it's done unless anyone has feedback on comments or docs. Anyone up for committing it?

This revision was not accepted when it landed; it landed in state Needs Review.Sep 3 2019, 8:57 PM
This revision was automatically updated to reflect the committed changes.