Bug 2162410

Summary: In /dev/mapper/ directory, link to /dev/dm-x device not created after vgmknodes
Product: Red Hat Enterprise Linux 9 Reporter: John Pittman <jpittman>
Component: lvm2Assignee: LVM Team <lvm-team>
lvm2 sub component: Udev QA Contact: cluster-qe <cluster-qe>
Status: NEW --- Docs Contact:
Severity: low    
Priority: low CC: agk, heinzm, jbrassow, msnitzer, nweddle, prajnoha, zkabelac
Version: 9.0Keywords: Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Pittman 2023-01-19 14:07:19 UTC
Description of problem:

In /dev/mapper/ directory, link to /dev/dm-x device not created after vgmknodes.  A vgchange --refresh makes does create the link.

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

lvm2-2.03.16-3.el9.x86_64
kernel-5.14.0-162.6.1.el9_1.x86_64

Steps to Reproduce:

[root@localhost ~]# lvs -ao +devices testvg
  LV    VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices    
  lvol0 testvg -wi-a----- 508.00m                                                     /dev/sda(0)
 
- Remove and all comes back with vgchange --refresh:
 
[root@localhost ~]# rm -rf /dev/mapper/testvg-lvol0
[root@localhost ~]# vgchange --refresh testvg
[root@localhost ~]# ls -lah /dev/mapper/testvg-lvol0
lrwxrwxrwx. 1 root root 7 Jan 18 16:45 /dev/mapper/testvg-lvol0 -> ../dm-2
 
- But using vgmknodes, link does not come back:
 
[root@localhost ~]# rm -rf /dev/mapper/testvg-lvol0
[root@localhost ~]# vgmknodes
[root@localhost ~]# ls -lah /dev/mapper/testvg-lvol0
brw-rw----. 1 root disk 253, 2 Jan 18 16:46 /dev/mapper/testvg-lvol0
 
[root@localhost ~]# rm -rf /dev/mapper/testvg-lvol0
[root@localhost ~]# vgmknodes --refresh
[root@localhost ~]# ls -lah /dev/mapper/testvg-lvol0
brw-rw----. 1 root disk 253, 2 Jan 18 16:46 /dev/mapper/testvg-lvol0
 
- Even after trigger, link not re-created:
 
[root@localhost ~]# rm -rf /dev/mapper/testvg-lvol0
[root@localhost ~]# vgmknodes
[root@localhost ~]# ls -lah /dev/mapper/testvg-lvol0
brw-rw----. 1 root disk 253, 2 Jan 18 16:52 /dev/mapper/testvg-lvol0
[root@localhost ~]# udevadm trigger
[root@localhost ~]# ls -lah /dev/mapper/testvg-lvol0
brw-rw----. 1 root disk 253, 2 Jan 18 16:52 /dev/mapper/testvg-lvol0

Actual results:

No /dev/mapper link created

Expected results:

The vgmknodes command and vgmknodes --refresh command should recreate the link.

Comment 1 Zdenek Kabelac 2023-02-11 10:02:36 UTC
Can we get attached

'vgmknodes -vvvv' 

'dmsetup info -c'

'udevadm info -e'

Also note - user should be using/accessing LVs via '/dev/testvg/lvol0' - this is documented and recommended way how to access LVs.

Usage of --refresh is actually better here since lvm2 command shouldn't be really used for creation of symlinks in /dev direcotry managed by udev.

Comment 5 Peter Rajnoha 2023-02-20 14:45:53 UTC
This is expected - we rely fully on udev to create the /dev content (including the vgmknodes) .As such, we need to trigger appropriate uevents. The "--refresh" will cause the underlying DM mappings to get reloaded/resumed which in turn will trigger these uevents, the pure vgmknodes won't. We should add a note to vgmknodes man page about this.

Comment 6 John Pittman 2023-02-21 14:36:46 UTC
Thanks Peter, Zdenek.  As a note, I tested 'vgscan --mknodes' and it shows the same behavior as the regular vgmknodes command.  I'm sure you prob already knew it was, just noting in the case you guys wanted to document that as well.  Thanks again.