linux-base: Check device IDs in mdadm.conf rather than assuming it needs manual conversion

svn path=/dists/sid/linux-2.6/; revision=15507
This commit is contained in:
Ben Hutchings 2010-04-10 21:34:30 +00:00
parent 72c1904abf
commit 9e945ceac0
2 changed files with 28 additions and 3 deletions

2
debian/changelog vendored
View File

@ -12,6 +12,8 @@ linux-2.6 (2.6.32-12) UNRELEASED; urgency=low
- Fix scope of _system() function (Closes: #576925)
- Fix case where a file may wrongly be listed as automatically converted
(Closes: #577047)
- Check device IDs in mdadm.conf rather than assuming it needs manual
conversion
[ maximilian attems]
* Ignore ABI breakage due to libata switch.

View File

@ -907,6 +907,25 @@ sub hdparm_list {
return @results;
}
### mdadm
sub mdadm_list {
my ($file) = @_;
my (@results) = ();
while (<$file>) {
# Look for DEVICE (case-insensitive, may be abbreviated to as
# little as 3 letters) followed by a whitespace-separated list
# of devices (or wildcards, or keywords!). Ignore comments
# (hash preceded by whitespace).
if (/^DEV(?:I(?:C(?:E)?)?)?[ \t]*((?:[^ \t]|[ \t][^#])*)/i) {
push @results, split(/[ \t]+/, $1);
}
}
return @results;
}
### list of all configuration files and functions
my @config_files = ({packages => 'mount',
@ -987,7 +1006,8 @@ my @config_files = ({packages => 'mount',
# mdadm.conf requires manual update because it may
# contain wildcards.
{packages => 'mdadm',
path => '/etc/mdadm/mdadm.conf'},
path => '/etc/mdadm/mdadm.conf',
list => \&mdadm_list},
# hdparm.conf requires manual update because it
# (1) refers to whole disks (2) might not work
# properly with the new drivers (3) is in a very
@ -1173,8 +1193,11 @@ sub scan_config_files {
$needs_update = defined($id_map_text) && $id_map_text ne '';
} elsif (exists($config->{list})) {
for my $bdev (&{$config->{list}}($file)) {
if ($bdev =~ m{^/dev/(?:[hs]d[a-z]\d*|s(?:cd|r)\d+)$} &&
-b $bdev) {
# Match standard IDE and SCSI device names, plus wildcards
# in disk device names to allow for mdadm insanity.
if ($bdev =~ m{^/dev/(?:[hs]d[a-z\?\*][\d\?\*]*|
s(?:cd|r)\d+)$}x &&
($bdev =~ m/[\?\*]/ || -b $bdev)) {
$bdev_map{$bdev} = {};
push @matched_bdevs, $bdev;
}