Tighten up regexp for HP Smart Array Devices

HP Smart Array Devices are listed in /proc/partitions as follows:

major minor  #blocks  name
 104     0  143338560 cciss/c0d0
 104     1     104391 cciss/c0d0p1
 104     2      24097 cciss/c0d0p2
 104     3  143203410 cciss/c0d0p3

The previous regular expression was too broad, and would match many
other forms, including Linux software RAID devices such as md127.

Linux software RAID devices are listed in /proc/partitions as follows:

major minor  #blocks  name
   9   127     523968 md127
 259     0     131072 md127p1
 259     1     262144 md127p2

This problem with the regexp was discovered while investigating a
problem with Linux software RAID device detection.

The regular expression has been tightened up to match the following
hardware RAID controllers:

  Compaq/HP Smartarray RAID controller
    E.g., device = /dev/cciss/c0d0, partition = /dev/cciss/c0d0p1
    (linux-x.y.z/Documentation/blockdev/cciss.txt)

  Compaq SMART2 Intelligent Disk Array controller
    E.g., device = /dev/ida/c0d0, partition = /dev/ida/c0d0p1
    (linux-x.y.z/Documentation/blockdev/cpqarray.txt)

  Mylex DAC960/AcceleRAID/eXtremeRAID PCI RAID Controllers
    E.g., device = /dev/rd/c0d0,  partition = /dev/rd/c0d0p1
    (linux-x.y.z/Documentation/blockdev/README.DAC960)

Related to Bug #678379 - Could not stat device /dev/md/0 - No such
                         file or directory
This commit is contained in:
Curtis Gedak 2012-11-14 11:57:53 -07:00
parent 83ccbce199
commit f003b3c4f2
1 changed files with 9 additions and 2 deletions

View File

@ -97,9 +97,16 @@ void Proc_Partitions_Info::load_proc_partitions_info_cache()
if ( device == "" )
device = Utils::regexp_label(line, "^[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+(mmcblk[0-9]+)$") ;
//Device names that end with a #[^p]# are HP Smart Array Devices (disks)
//E.g., device = /dev/cciss/c0d0, partition = /dev/cciss/c0d0p1
// E.g., device = /dev/cciss/c0d0, partition = /dev/cciss/c0d0p1
// (linux-x.y.z/Documentation/blockdev/cciss.txt)
//Device names for Compaq SMART2 Intelligent Disk Array
// E.g., device = /dev/ida/c0d0, partition = /dev/ida/c0d0p1
// (linux-x.y.z/Documentation/blockdev/cpqarray.txt)
//Device names for Mylex DAC960/AcceleRAID/eXtremeRAID PCI RAID
// E.g., device = /dev/rd/c0d0, partition = /dev/rd/c0d0p1
// (linux-x.y.z/Documentation/blockdev/README.DAC960)
if ( device == "" )
device = Utils::regexp_label(line, "^[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+(.*[0-9]+[^p]{1}[0-9]+)$") ;
device = Utils::regexp_label(line, "^[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+([a-z]+/c[0-9]+d[0-9]+)$") ;
if ( device != "" )
{
//add potential device to the list