lvm2: VG swaps to most recent disk if underlying PV has duplicate UUID and VG name

Bug #1869831 reported by Matthew Ruffell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lvm2 (Ubuntu)
Fix Released
Undecided
Unassigned
Xenial
Won't Fix
Medium
Matthew Ruffell
Bionic
Fix Released
Undecided
Unassigned
Disco
Fix Released
Undecided
Unassigned
Eoan
Fix Released
Undecided
Unassigned
Focal
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

On xenial with lvm2 2.02.133-1ubuntu10, if you say take a snapshot of a disk with an active VG, and attach that disk to the host, the VG will swap from the existing disk to the newly attached disk. This breaks mountpoints and directs writes to the wrong storage device.

Note this only happens in the edge case where the PV and VGs are absolute duplicates.

[Test]

Steps to reproduce:

1) Create a xenial instance.
2) Create a secondary disk and attach it.
3) Create a PV, VG and LV on the disk.
4) Run lsblk:

ubuntu@ubuntu:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vdb 253:16 0 2G 0 disk
└─test1-database 252:0 0 1.6G 0 lvm /mnt/database

5) Create a "snapshot" of this disk (cp -rp disk.qcow2 disk2.qcow2)
6) Attach disk2.qcow2. Check lsblk

ubuntu@ubuntu:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vdb 253:16 0 2G 0 disk
vdc 253:32 0 2G 0 disk
└─test1-database 252:0 0 1.6G 0 lvm

We can see the VG jumps from /dev/vdb to /dev/vdc, even though the system was
running at the time, and the VG was mounted.

[Regression Potential]

The risk of regression if we fix this issue is extreme.

The commits themselves are large and modify core LVM code, and change the behaviour of how disks are scanned and processed.
The commits introduce new configuration options.

The commits do not apply cleanly, and all of them require significant backporting, and quite a few dependencies.

Because of this, it would be far too risky to fix this for xenial, so I will mark this as wontfix.

[Other Info]

This was fixed in 2.02.153 by the following commits:

commit 49d9582bed338dc555b616bcc9de20fafd00ce2d
Author: David Teigland <email address hidden>
Date: Tue Mar 29 13:29:39 2016 -0500
Subject: lvmcache: use active LVs and device sizes to choose between duplicates
Link: https://github.com/lvmteam/lvm2/commit/49d9582bed338dc555b616bcc9de20fafd00ce2d

commit d4e434d1e6082ff4d448f4fbc03962c6f0926da4
Author: David Teigland <email address hidden>
Date: Fri Apr 29 14:42:14 2016 -0500
Subject: pvs: new attr and field for unchosen duplicate device
Link: https://github.com/lvmteam/lvm2/commit/d4e434d1e6082ff4d448f4fbc03962c6f0926da4

commit d3d13e134af15611c3f12107aa1627b12110a974
Author: David Teigland <email address hidden>
Date: Thu Feb 11 12:37:36 2016 -0600
Subject: lvmcache: process duplicate PVs directly
Link: https://github.com/lvmteam/lvm2/commit/d3d13e134af15611c3f12107aa1627b12110a974

commit 8b7a78c728be3b9af698dae9344d01752c4cf615
Author: David Teigland <email address hidden>
Date: Tue Feb 9 13:06:27 2016 -0600
Subject: lvmcache: improve duplicate PV handling
Link: https://github.com/lvmteam/lvm2/commit/8b7a78c728be3b9af698dae9344d01752c4cf615

commit 3d2fbfe243550b7801165f393d27e35044c1a56d
Author: David Teigland <email address hidden>
Date: Fri Jan 29 13:31:54 2016 -0600
Subject: lvmetad: set disabled flag when duplicate PVs are seen
Link: https://github.com/lvmteam/lvm2/commit/3d2fbfe243550b7801165f393d27e35044c1a56d

commit 9539ee809827a870c88d02cfb2d0dc1e3eaac0d0
Author: David Teigland <email address hidden>
Date: Fri Jan 29 12:25:20 2016 -0600
Subject: lvmetad: set disabled flag in lvmetad if duplicate PVs are found
Link: https://github.com/lvmteam/lvm2/commit/9539ee809827a870c88d02cfb2d0dc1e3eaac0d0

The fixes are present in Ubuntu 16.10 and later, meaning xenial is the only impacted supported release.

Tags: sts
Changed in lvm2 (Ubuntu Bionic):
status: New → Fix Released
Changed in lvm2 (Ubuntu Disco):
status: New → Fix Released
Changed in lvm2 (Ubuntu Eoan):
status: New → Fix Released
Changed in lvm2 (Ubuntu Focal):
status: New → Fix Released
Changed in lvm2 (Ubuntu Xenial):
status: New → Won't Fix
importance: Undecided → Medium
assignee: nobody → Matthew Ruffell (mruffell)
tags: added: sts
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.