[Bug 266635] gstripe fails depending on GPT label content

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 26 Sep 2022 18:48:33 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266635

            Bug ID: 266635
           Summary: gstripe fails depending on GPT label content
           Product: Base System
           Version: 13.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: freebsd-bugzilla@umpquanet.com

gstripe(8) sometimes does not recognize partition labels.

This code creates a stripe based on two stripe sets, which differ only in the
last element.  In both cases, the last GPT label refers to the same physical
partition on /dev/da11, namely da11p3.  If the GPT label `swap11` is used, the
stripe is created successfully.  But when the GPT label 'swap-C8338CHZ' is
used, 'gstripe label' returns success, but the stripe is marked as DOWN, with
only three of the four consumer devices shown as online.

Changing the name of the partition to 'swap11' allows the stripe to be created
successfully.

I'm happy to provide additional info on request.

FreeBSD 13.1-STABLE #0 stable/13-n251787-8e6cfc632cf6: Wed Jul 13 15:06:25 PDT
2022     root@jimsdesk:/usr/obj/usr/src/amd64.amd64/sys/GENERIC

Thank you!


#!/usr/bin/env bash

set -e

# Two stripe sets, where the last one $4 differs:
stripeSetA="gpt/swap8 gpt/swap9 gpt/swap10 gpt/swap-C8338CHZ"
stripeSetB="gpt/swap8 gpt/swap9 gpt/swap10 gpt/swap11"

gstripe destroy test || true

set -- $stripeSetA

gpart modify -l "${4/gpt\/}" -i3 da11
gpart show   -l da11
gstripe destroy test || true
( cd /dev && ls -l $@ )
gstripe label -h test $@ && printf 'Stripe created: test\n'
gstripe list test
gstripe destroy test && printf 'Stripe destroyed: test\n'

set -- $stripeSetB

gpart modify -l "${4/gpt\/}" -i3 da11
gpart show   -l da11
gstripe destroy test && printf 'Stripe destroyed: test\n'
( cd /dev && ls -l $@ )
gstripe label -h test $@ && printf 'Stripe created: test\n'
gstripe list test

printf 'Finished.\n'


Output:


gstripe: No such device: test.
da11p3 modified
=>         6  2441609205  da11  GPT  (9.1T)
           6         256     1  boot-C8338CHZ  (1.0M)
         262  2441084661     2  zfs-C8338CHZ  (9.1T)
  2441084923      524288     3  swap-C8338CHZ  (2.0G)

gstripe: No such device: test.
crw-r-----  1 root  operator  0x16b Sep 26 11:39 gpt/swap-C8338CHZ
crw-r-----  1 root  operator  0x1c1 Sep 26 11:36 gpt/swap10
crw-r-----  1 root  operator  0x1c5 Sep 26 11:31 gpt/swap8
crw-r-----  1 root  operator  0x1c3 Sep 26 11:31 gpt/swap9
Stripe created: test
Geom name: test
State: DOWN
Status: Total=4, Online=3
Type: AUTOMATIC
Stripesize: 65536
ID: 2547884802
Consumers:
1. Name: gpt/swap8
   Mediasize: 2147483648 (2.0G)
   Sectorsize: 4096
   Stripesize: 0
   Stripeoffset: 9998683844608
   Mode: r0w0e0
   Number: 0
2. Name: gpt/swap9
   Mediasize: 2147483648 (2.0G)
   Sectorsize: 4096
   Stripesize: 0
   Stripeoffset: 9998683844608
   Mode: r0w0e0
   Number: 1
3. Name: gpt/swap10
   Mediasize: 2147483648 (2.0G)
   Sectorsize: 4096
   Stripesize: 0
   Stripeoffset: 9998683844608
   Mode: r0w0e0
   Number: 2

Stripe destroyed: test
da11p3 modified
=>         6  2441609205  da11  GPT  (9.1T)
           6         256     1  boot-C8338CHZ  (1.0M)
         262  2441084661     2  zfs-C8338CHZ  (9.1T)
  2441084923      524288     3  swap11  (2.0G)

gstripe: No such device: test.
crw-r-----  1 root  operator  0x1c1 Sep 26 11:39 gpt/swap10
crw-r-----  1 root  operator  0x1ca Sep 26 11:39 gpt/swap11
crw-r-----  1 root  operator  0x1c5 Sep 26 11:39 gpt/swap8
crw-r-----  1 root  operator  0x1c3 Sep 26 11:39 gpt/swap9
Stripe created: test
Geom name: test
State: UP
Status: Total=4, Online=4
Type: AUTOMATIC
Stripesize: 65536
ID: 1503218330
Providers:
1. Name: stripe/test
   Mediasize: 8589672448 (8.0G)
   Sectorsize: 4096
   Stripesize: 65536
   Stripeoffset: 0
   Mode: r0w0e0
Consumers:
1. Name: gpt/swap8
   Mediasize: 2147483648 (2.0G)
   Sectorsize: 4096
   Stripesize: 0
   Stripeoffset: 9998683844608
   Mode: r0w0e0
   Number: 0
2. Name: gpt/swap9
   Mediasize: 2147483648 (2.0G)
   Sectorsize: 4096
   Stripesize: 0
   Stripeoffset: 9998683844608
   Mode: r0w0e0
   Number: 1
3. Name: gpt/swap10
   Mediasize: 2147483648 (2.0G)
   Sectorsize: 4096
   Stripesize: 0
   Stripeoffset: 9998683844608
   Mode: r0w0e0
   Number: 2
4. Name: gpt/swap11
   Mediasize: 2147483648 (2.0G)
   Sectorsize: 4096
   Stripesize: 0
   Stripeoffset: 9998683844608
   Mode: r0w0e0
   Number: 3

Finished.

-- 
You are receiving this mail because:
You are the assignee for the bug.