[CentOS] Sparse LUN's

Wed May 27 10:47:17 UTC 2009
Daniel Bird <dbird at sgul.ac.uk>

Hi All,
I've been chasing down a problem with LUN masking on CentOS5/RHEL5 hosts
with QLogic HBA's for a few hours and seem to have got to an impass;

Any device (disks in my case) on Non-sequential LUN's are not registered
with the OS. This happens across various HBA models and kernel
versions.  FYI, I'm currently running the latest qlogic qla2xxx drivers
(8.02.14.01) against kernel  2.6.18-128.1.10.el5 x86_64

For example if the LUN mask is set to 0,1,2,3 then all is OK and all
disks are configured. However, a mask of LUN 0 & 9  will not see the
disks on LUN 9. It appears the kernel stops scanning when there is a gap
in the LUN list.

I read in a number of places how to fix this issue, and indeed here:
http://filedownloads.qlogic.com/files/driver/48437/README_qla2xxx2-6U4.htm#BlacklistEntries

Apparently, I should be able to add a line to modprobe.conf that allows
sparse LUNs. So I followed the instructions and added

options scsi_mod dev_flags="SUN:CSM200_R:0x040" max_luns=20

and rebuilt initrd. This doesn't seem to work, as only LUN 0 is
configured by the OS despite LUN 9 also being unmasked.

I've also tried
options scsi_mod default_dev_flags=0x040 max_luns=20
in modprobe.conf with no luck


[root at host qlogic]#  cat /proc/scsi/qla2xxx/1
<snip>
SCSI LUN Information:
(Id:Lun)  * - indicates lun is not registered with the OS.
( 0: 0): Total reqs 144, Pending reqs 0, flags 0x2, Dflags 0x0, 0:0:83 00
( 0: 9): Total reqs 0, Pending reqs 0, flags 0x0*, Dflags 0x0, 0:0:83 00

[root at sgulfs-data1 ~]# cat /proc/scsi/scsi
Attached devices:
<snip>
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: SUN      Model: CSM200_R         Rev: 0616
  Type:   Direct-Access                    ANSI SCSI revision: 03


I can however do

echo "scsi add-single-device 1 0 0 9" > /proc/scsi/scsi

to enable LUN 9 and the disk is then configured.

I've ended up writing a script in rc.local to enable the LUN , scan LVM
and mount the file system which is not ideal.

Does anyone have any further insight into how I could get the OS to
enable these LUN's on boot thus eliminating the need for my doubtless
dirty script?

Cheers

Dan