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:
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
Note this feature is amended in bug 2111137 to provide the ability to disable it using multipath_component_detection=0.
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
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