From 451c8336ee2540ae403d2923726429cd5ebf9215 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 15 Jun 2010 00:25:07 +0000 Subject: [PATCH] linux-base: Don't identify LVM2 PVs by UUID (Closes: #585852) svn path=/dists/sid/linux-2.6/; revision=15873 --- debian/changelog | 1 + debian/linux-base.postinst | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 15dbb0774..52da45be8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -24,6 +24,7 @@ linux-2.6 (2.6.32-16) UNRELEASED; urgency=low - Enable BLK_DEV_SD as built-in on all platforms * Revert "vlan/macvlan: propagate transmission state to upper layers" (Closes: #585770) + * linux-base: Don't identify LVM2 PVs by UUID (Closes: #585852) [ Aurelien Jarno ] * [sh4] fix sh_tmu clocksource following recent nohz changes. diff --git a/debian/linux-base.postinst b/debian/linux-base.postinst index e932f6b8c..085631876 100644 --- a/debian/linux-base.postinst +++ b/debian/linux-base.postinst @@ -1267,7 +1267,7 @@ sub scan_devices { if (-x '/sbin/vol_id') { $id_command = '/sbin/vol_id'; } else { - $id_command = 'blkid -o udev -s LABEL -s UUID'; + $id_command = 'blkid -o udev -s LABEL -s UUID -s TYPE'; } for (`blkid -o device`) { chomp; @@ -1275,10 +1275,14 @@ sub scan_devices { for (`$id_command '$bdev'`) { if (/^ID_FS_(LABEL|UUID)_ENC=(.+)\n$/) { add_tag($bdev, $1, $2); + } elsif (/^ID_FS_TYPE=(.+)\n$/ && exists($bdev_map{$bdev})) { + $bdev_map{$bdev}->{type} //= $1; } } } + # Discard UUIDs for LVM2 PVs, as we assume there are symlinks for all + # UUIDs under /dev/disk/by-uuid and this is not true for PVs. # Discard all labels and UUIDs(!) that are ambiguous. # Discard all labels with 'unsafe' characters (escaped by blkid using # backslashes) as they will not be usable in all configuration files. @@ -1286,10 +1290,14 @@ sub scan_devices { # Sort each device's IDs in reverse lexical order so that UUIDs are # preferred. for my $bdev (keys(%bdev_map)) { - @{$bdev_map{$bdev}->{ids}} = - sort({$b cmp $a} - grep({ @{$id_map{$_}} == 1 && $_ !~ /[\\#]/ } - @{$bdev_map{$bdev}->{ids}})); + if ($bdev_map{$bdev}->{type} eq 'LVM2_member') { + @{$bdev_map{$bdev}->{ids}} = (); + } else { + @{$bdev_map{$bdev}->{ids}} = + sort({$b cmp $a} + grep({ @{$id_map{$_}} == 1 && $_ !~ /[\\#]/ } + @{$bdev_map{$bdev}->{ids}})); + } } # Add persistent aliases for CD/DVD/BD drives