RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1890299 - pvck dump and repair assume the first mda is always at 4096
Summary: pvck dump and repair assume the first mda is always at 4096
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: lvm2
Version: 8.3
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: 8.0
Assignee: David Teigland
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-10-21 20:33 UTC by David Teigland
Modified: 2021-09-07 11:51 UTC (History)
10 users (show)

Fixed In Version: lvm2-2.03.11-0.2.20201103git8801a86.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-18 15:02:04 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description David Teigland 2020-10-21 20:33:33 UTC
Description of problem:

While writing pvck dump and repair I was fixated on the common case where the first mda begins at 4096, but this offset is actually determined by the system page size which may be larger.  pvck dump and repair need to cope with non-4k values.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 David Teigland 2020-10-27 19:39:10 UTC
pushed to master
https://sourceware.org/git/?p=lvm2.git;a=commit;h=c96645781ceb88c625dfae73e5baa08f1ce0e07e

Have not found a way to really test this on a machine with non-4k page size, but forced lvm to use a 64k page size to test it.

Comment 7 Corey Marthaler 2021-01-27 21:04:36 UTC
Just an update that this bug is waiting on the fix bug 1917920 before final verification. The '--dump headers' and '--dump metadata' both "work" when in finding the mda when a VG is present.  However '--dump metadata' doesn't when a VG isn't present, but it appears nothing really happens with a PV not in a VG on an 4k page machine either.

# ppc64le machine

kernel-4.18.0-268.el8    BUILT: Mon Dec 28 03:47:31 CST 2020
lvm2-2.03.11-1.el8    BUILT: Fri Jan  8 05:20:47 CST 2021
lvm2-libs-2.03.11-1.el8    BUILT: Fri Jan  8 05:20:47 CST 2021

[root@p8-224-node1 ~]# getconf PAGESIZE
65536

[root@p8-224-node1 ~]# pvscan
  PV /dev/sda3             VG rhel_p8-224-node1   lvm2 [13.99 GiB / 0    free]
  PV /dev/mapper/mpatha1                          lvm2 [<52.50 GiB]
  PV /dev/mapper/mpatha2                          lvm2 [<52.50 GiB]
  Total: 3 [118.99 GiB] / in use: 1 [13.99 GiB] / in no VG: 2 [<105.00 GiB]

# This doesn't seem right?
[root@p8-224-node1 ~]# pvck --dump metadata /dev/mapper/mpatha1
  CHECK: pv_header.disk_locn[2].offset expected 4096 # for first mda
  Found bad header or metadata values.

[root@p8-224-node1 ~]# pvck --dump headers /dev/mapper/mpatha1
  label_header at 512
  label_header.id LABELONE
  label_header.sector 1
  label_header.crc 0xb5239dca
  label_header.offset 32
  label_header.type LVM2 001
  pv_header at 544
  pv_header.pv_uuid Y4YlzlYEjzfsTsCQ39OQgaTJfCqymH2m
  pv_header.device_size 56371425280
  pv_header.disk_locn[0] at 584 # location of data area
  pv_header.disk_locn[0].offset 33558016
  pv_header.disk_locn[0].size 0
  pv_header.disk_locn[1] at 600 # location list end
  pv_header.disk_locn[1].offset 0
  pv_header.disk_locn[1].size 0
  pv_header.disk_locn[2] at 616 # location of metadata area
  pv_header.disk_locn[2].offset 65536
  pv_header.disk_locn[2].size 33492480
  CHECK: pv_header.disk_locn[2].offset expected 4096 # for first mda
  pv_header.disk_locn[3] at 632 # location list end
  pv_header.disk_locn[3].offset 0
  pv_header.disk_locn[3].size 0
  pv_header_extension at 648
  pv_header_extension.version 2
  pv_header_extension.flags 0
  pv_header_extension.disk_locn[0] at 656 # location list end
  pv_header_extension.disk_locn[0].offset 0
  pv_header_extension.disk_locn[0].size 0
  mda_header_2 at 65536 # metadata area
  mda_header_2.checksum 0xf9229e2e
  mda_header_2.magic 0x204c564d3220785b35412572304e2a3e
  mda_header_2.version 1
  mda_header_2.start 65536
  mda_header_2.size 33492480
  mda_header_2.raw_locn[0] at 65576 # commit
  mda_header_2.raw_locn[0].offset 0
  mda_header_2.raw_locn[0].size 0
  mda_header_2.raw_locn[0].checksum 0x0
  mda_header_2.raw_locn[0].flags 0x0
  mda_header_2.raw_locn[1] at 65600 # precommit
  mda_header_2.raw_locn[1].offset 0
  mda_header_2.raw_locn[1].size 0
  mda_header_2.raw_locn[1].checksum 0x0
  mda_header_2.raw_locn[1].flags 0x0
  Found bad header or metadata values.



[root@p8-224-node1 ~]# vgcreate VG /dev/mapper/mpatha1
  Volume group "VG" successfully created

[root@p8-224-node1 ~]# pvck --dump metadata /dev/mapper/mpatha1
  CHECK: pv_header.disk_locn[2].offset expected 4096 # for first mda
  metadata text at 66048 crc 0x78cb18c7 # vgname VG seqno 1
  ---
VG {
id = "vfnNHd-Tf5F-aIdX-U5oc-ivP2-lxA3-UOSFsg"
seqno = 1
format = "lvm2"
status = ["RESIZEABLE", "READ", "WRITE"]
flags = []
extent_size = 8192
max_lv = 0
max_pv = 0
metadata_copies = 0

physical_volumes {

pv0 {
id = "Y4Ylzl-YEjz-fsTs-CQ39-OQga-TJfC-qymH2m"
device = "/dev/mapper/mpatha1"

status = ["ALLOCATABLE"]
flags = []
dev_size = 110100440
pe_start = 65543
pe_count = 13431
}
}


}
# Generated by LVM2 version 2.03.11(2)-RHEL8 (2021-01-08): Wed Jan 27 14:42:31 2021

contents = "Text Format Volume Group"
version = 1

description = "Write from vgcreate VG /dev/mapper/mpatha1."

creation_host = "p8-224-node1.lab.msp.redhat.com"       # Linux p8-224-node1.lab.msp.redhat.com 4.18.0-268.el8.ppc64le #1 SMP Mon Dec 28 04:29:22 EST 2020 ppc64le
creation_time = 1611780151      # Wed Jan 27 14:42:31 2021


  ---
  Found bad header or metadata values.



[root@p8-224-node1 ~]# pvck --dump headers /dev/mapper/mpatha1
  label_header at 512
  label_header.id LABELONE
  label_header.sector 1
  label_header.crc 0xb46a6824
  label_header.offset 32
  label_header.type LVM2 001
  pv_header at 544
  pv_header.pv_uuid Y4YlzlYEjzfsTsCQ39OQgaTJfCqymH2m
  pv_header.device_size 56371425280
  pv_header.disk_locn[0] at 584 # location of data area
  pv_header.disk_locn[0].offset 33558016
  pv_header.disk_locn[0].size 0
  pv_header.disk_locn[1] at 600 # location list end
  pv_header.disk_locn[1].offset 0
  pv_header.disk_locn[1].size 0
  pv_header.disk_locn[2] at 616 # location of metadata area
  pv_header.disk_locn[2].offset 65536
  pv_header.disk_locn[2].size 33492480
  CHECK: pv_header.disk_locn[2].offset expected 4096 # for first mda
  pv_header.disk_locn[3] at 632 # location list end
  pv_header.disk_locn[3].offset 0
  pv_header.disk_locn[3].size 0
  pv_header_extension at 648
  pv_header_extension.version 2
  pv_header_extension.flags 1
  pv_header_extension.disk_locn[0] at 656 # location list end
  pv_header_extension.disk_locn[0].offset 0
  pv_header_extension.disk_locn[0].size 0
  mda_header_2 at 65536 # metadata area
  mda_header_2.checksum 0x518e92ba
  mda_header_2.magic 0x204c564d3220785b35412572304e2a3e
  mda_header_2.version 1
  mda_header_2.start 65536
  mda_header_2.size 33492480
  mda_header_2.raw_locn[0] at 65576 # commit
  mda_header_2.raw_locn[0].offset 512
  mda_header_2.raw_locn[0].size 804
  mda_header_2.raw_locn[0].checksum 0x78cb18c7
  mda_header_2.raw_locn[0].flags 0x0
  mda_header_2.raw_locn[1] at 65600 # precommit
  mda_header_2.raw_locn[1].offset 0
  mda_header_2.raw_locn[1].size 0
  mda_header_2.raw_locn[1].checksum 0x0
  mda_header_2.raw_locn[1].flags 0x0
  metadata text at 66048 crc 0x78cb18c7 # vgname VG seqno 1
  Found bad header or metadata values.
[root@p8-224-node1 ~]# echo $?
5




# Here is a 4k page x86_64 machine to compare
[root@hayes-03 ~]# getconf PAGESIZE
4096

[root@hayes-03 ~]# pvcreate /dev/sd[bc]1
  Physical volume "/dev/sdb1" successfully created.
  Physical volume "/dev/sdc1" successfully created.

[root@hayes-03 ~]#  pvck --dump metadata  /dev/sdb1
[root@hayes-03 ~]#  pvck --dump headers  /dev/sdb1
  label_header at 512
  label_header.id LABELONE
  label_header.sector 1
  label_header.crc 0xd19a1c58
  label_header.offset 32
  label_header.type LVM2 001
  pv_header at 544
  pv_header.pv_uuid RdkIkvL1pXPRxidWJhV1PVH26bbNjdfG
  pv_header.device_size 479559901184
  pv_header.disk_locn[0] at 584 # location of data area
  pv_header.disk_locn[0].offset 1048576
  pv_header.disk_locn[0].size 0
  pv_header.disk_locn[1] at 600 # location list end
  pv_header.disk_locn[1].offset 0
  pv_header.disk_locn[1].size 0
  pv_header.disk_locn[2] at 616 # location of metadata area
  pv_header.disk_locn[2].offset 4096
  pv_header.disk_locn[2].size 1044480
  pv_header.disk_locn[3] at 632 # location list end
  pv_header.disk_locn[3].offset 0
  pv_header.disk_locn[3].size 0
  pv_header_extension at 648
  pv_header_extension.version 2
  pv_header_extension.flags 0
  pv_header_extension.disk_locn[0] at 656 # location list end
  pv_header_extension.disk_locn[0].offset 0
  pv_header_extension.disk_locn[0].size 0
  mda_header_1 at 4096 # metadata area
  mda_header_1.checksum 0xdb8ed616
  mda_header_1.magic 0x204c564d3220785b35412572304e2a3e
  mda_header_1.version 1
  mda_header_1.start 4096
  mda_header_1.size 1044480
  mda_header_1.raw_locn[0] at 4136 # commit
  mda_header_1.raw_locn[0].offset 0
  mda_header_1.raw_locn[0].size 0
  mda_header_1.raw_locn[0].checksum 0x0
  mda_header_1.raw_locn[0].flags 0x0
  mda_header_1.raw_locn[1] at 4160 # precommit
  mda_header_1.raw_locn[1].offset 0
  mda_header_1.raw_locn[1].size 0
  mda_header_1.raw_locn[1].checksum 0x0
  mda_header_1.raw_locn[1].flags 0x0

Comment 8 Corey Marthaler 2021-02-02 00:56:54 UTC
Marking verified now with the latest lvm build.

kernel-4.18.0-268.el8    BUILT: Mon Dec 28 03:47:31 CST 2020
lvm2-2.03.11-2.el8    BUILT: Thu Jan 28 14:41:14 CST 2021
lvm2-libs-2.03.11-2.el8    BUILT: Thu Jan 28 14:41:14 CST 2021

[root@p8-224-node1 ~]# uname -ar
Linux p8-224-node1.lab.msp.redhat.com 4.18.0-268.el8.ppc64le #1 SMP Mon Dec 28 04:29:22 EST 2020 ppc64le ppc64le ppc64le GNU/Linux

[root@p8-224-node1 ~]# vgcreate VG /dev/mapper/mpatha1
  Volume group "VG" successfully created

[root@p8-224-node1 ~]# pvck --dump metadata /dev/mapper/mpatha1
  metadata text at 66048 crc 0xb2fd4187 # vgname VG seqno 1
  ---
VG {
id = "6wGlD9-YQTU-Nj4y-IZ5n-7qb4-g4WL-4k1b9y"
seqno = 1
format = "lvm2"
status = ["RESIZEABLE", "READ", "WRITE"]
flags = []
extent_size = 8192
max_lv = 0
max_pv = 0
metadata_copies = 0

physical_volumes {

pv0 {
id = "Y4Ylzl-YEjz-fsTs-CQ39-OQga-TJfC-qymH2m"
device = "/dev/mapper/mpatha1"

status = ["ALLOCATABLE"]
flags = []
dev_size = 110100440
pe_start = 65543
pe_count = 13431
}
}


}
# Generated by LVM2 version 2.03.11(2)-RHEL8 (2021-01-28): Mon Feb  1 18:22:29 2021

contents = "Text Format Volume Group"
version = 1

description = "Write from vgcreate VG /dev/mapper/mpatha1."

creation_host = "p8-224-node1.lab.msp.redhat.com"       # Linux p8-224-node1.lab.msp.redhat.com 4.18.0-268.el8.ppc64le #1 SMP Mon Dec 28 04:29:22 EST 2020 ppc64le
creation_time = 1612225349      # Mon Feb  1 18:22:29 2021


  ---
[root@p8-224-node1 ~]# echo $?
0
[root@p8-224-node1 ~]# pvck --dump headers /dev/mapper/mpatha1
  label_header at 512
  label_header.id LABELONE
  label_header.sector 1
  label_header.crc 0xb46a6824
  label_header.offset 32
  label_header.type LVM2 001
  pv_header at 544
  pv_header.pv_uuid Y4YlzlYEjzfsTsCQ39OQgaTJfCqymH2m
  pv_header.device_size 56371425280
  pv_header.disk_locn[0] at 584 # location of data area
  pv_header.disk_locn[0].offset 33558016
  pv_header.disk_locn[0].size 0
  pv_header.disk_locn[1] at 600 # location list end
  pv_header.disk_locn[1].offset 0
  pv_header.disk_locn[1].size 0
  pv_header.disk_locn[2] at 616 # location of metadata area
  pv_header.disk_locn[2].offset 65536
  pv_header.disk_locn[2].size 33492480
  pv_header.disk_locn[3] at 632 # location list end
  pv_header.disk_locn[3].offset 0
  pv_header.disk_locn[3].size 0
  pv_header_extension at 648
  pv_header_extension.version 2
  pv_header_extension.flags 1
  pv_header_extension.disk_locn[0] at 656 # location list end
  pv_header_extension.disk_locn[0].offset 0
  pv_header_extension.disk_locn[0].size 0
  mda_header_2 at 65536 # metadata area
  mda_header_2.checksum 0x1d6340d6
  mda_header_2.magic 0x204c564d3220785b35412572304e2a3e
  mda_header_2.version 1
  mda_header_2.start 65536
  mda_header_2.size 33492480
  mda_header_2.raw_locn[0] at 65576 # commit
  mda_header_2.raw_locn[0].offset 512
  mda_header_2.raw_locn[0].size 804
  mda_header_2.raw_locn[0].checksum 0xb2fd4187
  mda_header_2.raw_locn[0].flags 0x0
  mda_header_2.raw_locn[1] at 65600 # precommit
  mda_header_2.raw_locn[1].offset 0
  mda_header_2.raw_locn[1].size 0
  mda_header_2.raw_locn[1].checksum 0x0
  mda_header_2.raw_locn[1].flags 0x0
  metadata text at 66048 crc 0xb2fd4187 # vgname VG seqno 1
[root@p8-224-node1 ~]# echo $?
0

Comment 9 Corey Marthaler 2021-02-02 01:03:57 UTC
Here is a repair example as well:

[root@p8-224-node1 ~]# pvck --dump metadata /dev/mapper/mpatha2 -f /tmp/foo
  metadata text at 66048 crc 0xb46c6b40 # vgname test2 seqno 1

[root@p8-224-node1 ~]# cat /tmp/foo
test2 {
id = "qZ3MD5-ktbH-KKGq-3dJg-yWMM-CAom-TVFIGo"
seqno = 1
format = "lvm2"
status = ["RESIZEABLE", "READ", "WRITE"]
flags = []
extent_size = 8192
max_lv = 0
max_pv = 0
metadata_copies = 0

physical_volumes {

pv0 {
id = "lGxAYD-crgA-erOt-mw5J-E5mZ-43CS-0ED7JK"
device = "/dev/mapper/mpatha2"

status = ["ALLOCATABLE"]
flags = []
dev_size = 110100440
pe_start = 65535
pe_count = 13431
}
}


}
# Generated by LVM2 version 2.03.11(2)-RHEL8 (2021-01-28): Mon Feb  1 19:01:16 2021

contents = "Text Format Volume Group"
version = 1

description = "Write from vgcreate test2 /dev/mapper/mpatha2."

creation_host = "p8-224-node1.lab.msp.redhat.com"       # Linux p8-224-node1.lab.msp.redhat.com 4.18.0-268.el8.ppc64le #1 SMP Mon Dec 28 04:29:22 EST 2020 ppc64le
creation_time = 1612227676      # Mon Feb  1 19:01:16 2021

[root@p8-224-node1 ~]# pvck --yes --repair -f /tmp/foo /dev/mapper/mpatha2
  Writing label_header.crc 0xcef3da61 pv_header uuid lGxAYDcrgAerOtmw5JE5mZ43CS0ED7JK device_size 56371425280
  Writing data_offset 33553920 mda1_offset 4096 mda1_size 33549824 mda2_offset 0 mda2_size 0
  Writing metadata at 4608 length 810 crc 0xb46c6b40 mda1
  Writing mda_header at 4096 mda1

Comment 11 errata-xmlrpc 2021-05-18 15:02:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (lvm2 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1659


Note You need to log in before you can comment on or make changes to this bug.