Bug 2167370 - LVM metadata is broken if device_id is set and contains a double quote
Summary: LVM metadata is broken if device_id is set and contains a double quote
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: lvm2
Version: 9.1
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: David Teigland
QA Contact: cluster-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-02-06 12:17 UTC by Lars
Modified: 2023-08-10 15:41 UTC (History)
9 users (show)

Fixed In Version: lvm2-2.03.21-1.el9
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)
volume group backup (1.85 KB, text/plain)
2023-02-06 12:17 UTC, Lars
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker CLUSTERQE-6688 0 None None None 2023-05-16 00:14:49 UTC
Red Hat Issue Tracker RHELPLAN-147619 0 None None None 2023-02-06 12:19:21 UTC

Description Lars 2023-02-06 12:17:23 UTC
Created attachment 1942532 [details]
volume group backup

Description of problem:
LVM metadata is broken if device_id is set and contains a double quote `"`

Version-Release number of selected component (if applicable):
LVM2 version 2.03.16(2) (2022-05-18): Wed Feb  1 16:46:42 2023

How reproducible:
- install Rocky/Alma Linux 9.1 on a Broadwell system with Intel i3-5010U CPU, 4 GB RAM and 32 GB Innodisk 2.5" SATA SSD 3MG2-P
- do minimal installation and use LVM for disk partitioning
- the volume group uses all available space and assigns 10 GB to the root partition so that there are still ~14 GB available space in the volume group:

	[root@localhost ~]# vgs
	  VG #PV #LV #SN Attr   VSize   VFree  
	  rl   1   2   0 wz--n- <27.30g <14.41g

	[root@localhost ~]# lvs
	  LV   VG Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
	  root rl -wi-ao---- 10.00g                                                    
	  swap rl -wi-ao----  2.89g                                                    

	[root@localhost ~]# df -h
	  Filesystem           Size  Used Avail Use% Mounted on
	  devtmpfs             4.0M     0  4.0M   0% /dev
	  tmpfs                1.8G     0  1.8G   0% /dev/shm
	  tmpfs                713M  9.1M  704M   2% /run
	  /dev/mapper/rl-root   10G  1.1G  9.0G  11% /
	  /dev/sda2           1014M  214M  801M  22% /boot
	  /dev/sda1            599M  7.0M  592M   2% /boot/efi
	  tmpfs                357M     0  357M   0% /run/user/0

Steps to Reproduce:
Try to create a lvm snapshot of the root partiton:

	[root@localhost ~]# lvcreate -v -s rl/root -n root_snapshot -L 5G
	  Setting chunksize to 4.00 KiB.
	  Creating logical volume root_snapshot
	  Archiving volume group "rl" metadata (seqno 3).
	  Parse error at byte 401 (line 20): unexpected token
	  Error parsing metadata for VG rl.
	  Failed to write VG rl.

Actual results:
Failed to create the lvm snapshot.

Expected results:
lvm snapshot should be created.

Additional info:
Found while watching the lvm backup & archive files - in short / full backup is attached:

	# Generated by LVM2 version 2.03.16(2) (2022-05-18): Wed Feb  1 16:46:42 2023
	...
	rl {
		...
		physical_volumes {
			pv0 {
				id = "9iGP6J-AS0i-URS2-W5gV-t3pu-Fr1Z-Rj5myh"
				device = "/dev/sda3"	# Hint only

				device_id_type = "sys_wwid"
				device_id = "t10.ATA_____2.5"_SATA_SSD_3MG2-P____________________20161128AA0018230001"
				...
			}
		}
		logical_volumes {
			...
		}
	}

Comment 1 David Teigland 2023-02-06 18:47:02 UTC
fix in main
https://sourceware.org/git/?p=lvm2.git;a=commit;h=dc99f0def17b936f95c63612a56ae2a6ae81db0e


Reformatted test output from devicesfile-vpd-ids.sh:

$ mkdir -p /test/sys/dev/block/8:32/
$ echo "t10.ATA_2.5\"_SATA_SSD_1112-A___111111111111" > /test/sys/dev/block/8:32/wwid

$ lvmdevices --adddev /dev/sdc

$ cat /tmp/LVMTEST47875.lw0KIc9Bga/etc/devices/system.devices
 # LVM uses devices listed in this file.
 # Created by LVM command lvmdevices pid 48170 at Mon Feb  6 12:17:21 2023
 VERSION=1.1.1
 IDTYPE=sys_wwid IDNAME=t10.ATA_2.5_SATA_SSD_1112-A___111111111111 DEVNAME=/dev/sdc PVID=. 

$ vgcreate LVMTEST47875vg /dev/sdc
   Physical volume "/dev/sdc" successfully created.
   Volume group "LVMTEST47875vg" successfully created

$ lvcreate -l1 -an LVMTEST47875vg
   Logical volume "lvol0" created.

$ cat /tmp/LVMTEST47875.lw0KIc9Bga/etc/devices/system.devices
 # LVM uses devices listed in this file.
 # Created by LVM command vgcreate pid 48172 at Mon Feb  6 12:17:21 2023
 VERSION=1.1.2
 IDTYPE=sys_wwid IDNAME=t10.ATA_2.5_SATA_SSD_1112-A___111111111111 DEVNAME=/dev/sdc PVID=0SGGnXmf1WwGjjzApiNLxmt4tClh02IK

$ pvs -o+deviceidtype,deviceid /dev/sdc
   PV         VG             Fmt  Attr PSize  PFree DeviceIDType DeviceID
   /dev/sdc   LVMTEST47875vg lvm2 a--  12.00m 8.00m sys_wwid     t10.ATA_2.5_SATA_SSD_1112-A___111111111111

Comment 5 Corey Marthaler 2023-06-20 15:55:37 UTC
Marking Verified:Tested based on results provided in comment #1.


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