Page MenuHomeFreeBSD

Allow more nesting of GEOM partitioning schemes
ClosedPublic

Authored by andrew_tao173.riddles.org.uk on Aug 21 2019, 1:37 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
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

imp added a comment.Aug 21 2019, 3:17 PM

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.

imp added a comment.Aug 21 2019, 9:01 PM

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 marked 2 inline comments as done.Fri, Aug 23, 9:14 AM
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.Tue, Sep 3, 8:57 PM
This revision was automatically updated to reflect the committed changes.