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 2095534 - use wwid to eliminate duplicate devices from multipath or mdraid
Summary: use wwid to eliminate duplicate devices from multipath or mdraid
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: lvm2
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: David Teigland
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-06-09 21:34 UTC by David Teigland
Modified: 2022-11-08 12:52 UTC (History)
8 users (show)

Fixed In Version: lvm2-2.03.14-4.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-08 10:55:29 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-124936 0 None Closed CVE-2021-41819 fix ETA for Ruby 2.7 on RHEL 8 2022-06-27 00:50:38 UTC
Red Hat Product Errata RHBA-2022:7792 0 None None None 2022-11-08 10:55:45 UTC

Description David Teigland 2022-06-09 21:34:23 UTC
Description of problem:

lvm attempts to identify component devices from mdraid or multipath early (during internal pre-scan filtering), to avoid scanning those underlying devices entirely.
This is usually successful, but in some cases, the early detection can fail, which results in lvm scanning multipath/mdraid components and often the md/mp device itself (if it's set up).  This triggers the "duplicate PV" code in lvm, and lvm will not activate or change VGs/LVs with duplicate PVs.  This often happens during boot, when the normal detection methods are most likely to not work, and creates a major headache for users (non-booting machine.)

Since the devices file was added, lvm is now aware of the wwid of the PVs it scans, which provides a new method of resolving duplicate PVs caused by failed md/mp component detection.  lvm can simply compare the wwids of duplicate PVs and eliminate them if they are actually the same underlying device.  It's still preferable to identify the components earlier, but this should be a very effective final defense against failure due to failed component detection.  (The PVs need to report wwids.)

To test this, the normal methods of avoiding component devs need to be disabled.
For multipath, in lvm.conf set multipath_component_detection=0 and multipath_wwids_file="".  Then, verify that 'pvs' and vgchange -ay <vgname> both work without a problem.  The internal lvm debugging will include messages about "duplicate device" but lvm will automatically eliminate them, allowing the commands to succeed.

# pvs -vvvv 2>&1| grep 'duplicate device'
16:32:03.581763 pvs[1438039] cache/lvmcache.c:2513  Saving initial duplicate device /dev/sdf previously seen on /dev/mapper/mpatha with PVID kkzqgYH7rBIavk5qEC2hSuvIFJWyyhC9.
16:32:03.581851 pvs[1438039] cache/lvmcache.c:1642  Resolving duplicate devices

# vgchange -ay -vvvv test 2>&1 | grep 'duplicate device'
16:32:33.117461 vgchange[1438050] cache/lvmcache.c:2513  Saving initial duplicate device /dev/sdf previously seen on /dev/mapper/mpatha with PVID kkzqgYH7rBIavk5qEC2hSuvIFJWyyhC9.
16:32:33.117546 vgchange[1438050] cache/lvmcache.c:1642  Resolving duplicate devices

# lvs test
  LV    VG   Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lvol0 test -wi-a----- 4.00m                                                    


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 4 Corey Marthaler 2022-07-18 22:29:29 UTC
Marking Verified:Tested in the latest build.


kernel-4.18.0-398.g366e.el8.kpq1    BUILT: Tue Jun  7 04:56:38 CDT 2022
lvm2-2.03.14-4.el8    BUILT: Wed Jun 15 17:14:34 CDT 2022
lvm2-libs-2.03.14-4.el8    BUILT: Wed Jun 15 17:14:34 CDT 2022



[root@hayes-01 ~]# grep multipath_component_detection /etc/lvm/lvm.conf 
        # Configuration option devices/multipath_component_detection.
        # multipath_component_detection = 1
        #
[root@hayes-01 ~]# grep multipath_wwids_file /etc/lvm/lvm.conf 
        # Configuration option devices/multipath_wwids_file.
        # multipath_wwids_file = "/etc/multipath/wwids"

[root@hayes-01 ~]# multipath -ll
mpathd (36d094660575ece002291bade2acdbd28) dm-0 DELL,PERC H330 Adp
size=1.8T features='0' hwhandler='0' wp=rw
`-+- policy='service-time 0' prio=1 status=active
  `- 0:2:4:0  sde 8:64  active ready running

[root@hayes-01 ~]# pvcreate /dev/mapper/mpathd1
  Physical volume "/dev/mapper/mpathd1" successfully created.
[root@hayes-01 ~]# vgcreate test /dev/mapper/mpathd1
  Volume group "test" successfully created

[root@hayes-01 ~]# lvcreate -L 10M test
  Rounding up size to full physical extent 12.00 MiB
  Logical volume "lvol0" created.

[root@hayes-01 ~]# pvscan
  PV /dev/mapper/mpathd1   VG test            lvm2 [<1.82 TiB / <1.82 TiB free]
  Total: 1 [<1.82 TiB] / in use: 1 [<1.82 TiB] / in no VG: 0 [0   ]

# Alter lvm.conf
[root@hayes-01 ~]# grep multipath_component_detection /etc/lvm/lvm.conf 
        # Configuration option devices/multipath_component_detection.
        multipath_component_detection = 0
[root@hayes-01 ~]# grep multipath_wwids_file /etc/lvm/lvm.conf 
        # Configuration option devices/multipath_wwids_file.
        multipath_wwids_file = ""
[root@hayes-01 ~]# pvscan
  PV /dev/mapper/mpathd1   VG test            lvm2 [<1.82 TiB / <1.82 TiB free]
  Total: 1 [<1.82 TiB] / in use: 1 [<1.82 TiB] / in no VG: 0 [0   ]


[root@hayes-01 ~]# pvs
  PV                  VG   Fmt  Attr PSize  PFree 
  /dev/mapper/mpathd1 test lvm2 a--  <1.82t <1.82t
[root@hayes-01 ~]# echo $?
0
[root@hayes-01 ~]# vgchange -ay test
  1 logical volume(s) in volume group "test" now active
[root@hayes-01 ~]# echo $?
0
[root@hayes-01 ~]# lvs test
  LV    VG   Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lvol0 test -wi-a----- 12.00m

Comment 5 David Teigland 2022-07-26 14:53:47 UTC
Note this feature is amended in bug 2111137 to provide the ability to disable it using multipath_component_detection=0.

Comment 8 Corey Marthaler 2022-08-10 02:51:22 UTC
Marking VERIFIED with the latest rpms.

kernel-4.18.0-414.el8    BUILT: Mon Aug  1 20:27:19 CDT 2022
lvm2-2.03.14-6.el8    BUILT: Fri Jul 29 05:40:53 CDT 2022
lvm2-libs-2.03.14-6.el8    BUILT: Fri Jul 29 05:40:53 CDT 2022



SCENARIO - lvm_usage_w_multipath_component_detection_disabled:  Test that lvm doesn't ignore multipath component_detection with devicesfile disabled (bug 2111137/2095534)
adding entry to the devices file for /dev/sde1
removing entry from the devices file for /dev/sde1
Setting use_devicesfile to disable
Setting multipath_component_detection to enable
WARNING: This scenario will end up repartitioning your device for use w/ mpath!
multipath /dev/sde
create: mpatha (36d094660650d1e0022bd29f91ebe756c) undef DELL,PERC H330 Adp
size=1.8T features='0' hwhandler='0' wp=undef
`-+- policy='service-time 0' prio=1 status=undef
  `- 0:2:4:0  sde 8:64  undef ready running

adding entry to the devices file for /dev/mapper/mpatha1
** use_devicesfile is NOT currently enabled **
creating PV on hayes-02 using device /dev/mapper/mpatha1
pvcreate --yes -ff   /dev/mapper/mpatha1
  Physical volume "/dev/mapper/mpatha1" successfully created.
creating VG on hayes-02 using PV(s) /dev/mapper/mpatha1
vgcreate    df /dev/mapper/mpatha1
  Volume group "df" successfully created
lvcreate --yes --type linear -n dflv  -L 500M df  
Logical volume "dflv" created.

Re-scanning lvm PVs (pvscan --cache)
  pvscan[28415] PV /dev/mapper/mpatha1 online.
Setting multipath_component_detection to disable
Re-scanning lvm PVs (pvscan --cache)
  pvscan[28425] PV /dev/mapper/mpatha1 online.
verify pvs multipath path /dev/mapper/mpatha1
  PV                  VG Fmt  Attr PSize  PFree 
  /dev/mapper/mpatha1 df lvm2 a--  <1.82t <1.82t
pvs -vvvv 2>&1| grep 'duplicate device'
vgchange -ay -vvvv test 2>&1 | grep 'duplicate device'
lvremove  -f df/dflv
  Logical volume "dflv" successfully removed.
removing vg df from hayes-02
  Volume group "df" successfully removed
removing pv /dev/mapper/mpatha1 on hayes-02
  Labels on physical volume "/dev/mapper/mpatha1" successfully wiped.
removing entry from the devices file for /dev/mapper/mpatha1
** use_devicesfile is NOT currently enabled **
multipath -f mpatha
multipath -W
successfully reset wwids
Device /dev/sde already has 1 partitions
Setting use_devicesfile to enable
Setting multipath_component_detection to enable

Comment 10 errata-xmlrpc 2022-11-08 10:55:29 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-2022:7792


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