Bug 2162410 - In /dev/mapper/ directory, link to /dev/dm-x device not created after vgmknodes
Summary: In /dev/mapper/ directory, link to /dev/dm-x device not created after vgmknodes
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: lvm2
Version: 9.0
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: LVM Team
QA Contact: cluster-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-19 14:07 UTC by John Pittman
Modified: 2023-08-10 15:40 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-148354 0 None None None 2023-02-11 10:04:00 UTC

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.


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