Skip to contentSkip to conversation

4/6: scsi_allow_ghost_devices

PATCH In review Kurt Garloff 6 participants 8 messages Apr 18, 2004 – Apr 20, 2004 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 4/6: scsi_allow_ghost_devices

Feature.

scsi_allow_ghost_devices=N
This patch introduces a boot/module parameter that allows the user to tell the kernel to NOT set the first N devices to offline despite they would normally be. Needed for some EMC multipathing devices.
This parameter is even documented in EMC docs as both RH and SUSE had such a parameter in their 2.4 vendor kernels :-/

drivers/scsi/scsi_scan.c renamed from drivers/scsi/scsi_scan.c.orig +8 -1
@@ -119,6 +119,12 @@ module_param_named(scsi_reportlun2, scsi
 MODULE_PARM_DESC(scsi_reportlun2,
 		 "Use REPORT_LUNs for scanning SCSI-2 devs as well");
 
+static unsigned int scsi_allow_ghost_devices;
+module_param_named(scsi_allow_ghost_devices ,scsi_allow_ghost_devices, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(scsi_allow_ghost_devices, 
+		 "allow devices marked as being offline to be accessed anyway "
+		 "(0 = off, else allow ghosts on lun 0 through allow_ghost_devices - 1");
+
 
 /**
  * scsi_unlock_floptical - unlock device via a special MODE SENSE command
@@ -573,7 +579,8 @@ static int scsi_add_lun(struct scsi_devi
 	 * otherwise, offline devices still get an sd allocated, and they
 	 * use up an sd slot.
 	 */
-	if (((inq_result[0] >> 5) & 7) == 1) {
+	if (((inq_result[0] >> 5) & 7) == 1 &&
+	    (sdev->lun >= scsi_allow_ghost_devices)) {
 		SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: peripheral"
 				" qualifier of 1, device offlined\n"));
 		sdev->online = FALSE;
Signature · 2 lines
Kurt Garloff  <[email protected]>                            Cologne, DE 
SUSE LINUX AG, Nuernberg, DE                          SUSE Labs (Head)
#1 lore raw
Quoted 9 lines · Kurt Garloff

Feature.

scsi_allow_ghost_devices=N
This patch introduces a boot/module parameter that allows the user to tell the kernel to NOT set the first N devices to offline despite they would normally be. Needed for some EMC multipathing devices.
This parameter is even documented in EMC docs as both RH and SUSE had such a parameter in their 2.4 vendor kernels :-/

I'm very unhappy with that. Could you explain why EMC needs this? And even if we have to work around it I'd rather use the blacklist mechanism for this.

#2 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 6 lines · Kurt Garloff

scsi_allow_ghost_devices=N
This patch introduces a boot/module parameter that allows the user to tell the kernel to NOT set the first N devices to offline despite they would normally be. Needed for some EMC multipathing devices.
This parameter is even documented in EMC docs as both RH and SUSE had such a parameter in their 2.4 vendor kernels :-/

I'm very unhappy with that.

So am I.
But there's compromises you have to take ...

Quoted 1 line

Could you explain why EMC needs this?

Hmm, it's some time ago.
The LUN 0 is used for multipathing and becomes active if another path fails. Something they use in PowerPath IIRC.

Quoted 2 lines

And even if we have to work around it I'd rather use the blacklist mechanism for this.

There's no bits left :-(
There's one difference: The parameter could be used to set more LUNs unconditionally to online, though I believe EMC only needs LUN 0.

Regards,

Signature · 3 lines
Kurt Garloff                   <[email protected]>             [Koeln, DE]
Physics:Plasma modeling <[email protected]> [TU Eindhoven, NL]
Linux: SUSE Labs (Head)        <[email protected]>    [SUSE Nuernberg, DE]
#3 lore raw
In reply to Christoph Hellwig
Quoted 4 lines

I'm very unhappy with that. Could you explain why EMC needs this? And even if we have to work around it I'd rather use the blacklist mechanism for this.

they allow the admin to config the box without a lun 0.... I 100% agree it's blacklist material.

#4 lore raw
Quoted 6 lines · Arjan van de Ven
Quoted 3 lines

I'm very unhappy with that. Could you explain why EMC needs this? And even if we have to work around it I'd rather use the blacklist mechanism for this.

they allow the admin to config the box without a lun 0.... I 100% agree it's blacklist material.

Actually, the original reason for the patch was the fact that some external boxes use LUN 0 as a control device that you send commands to in order to init logical volumes. Without access to the control device (which previously was always shown as offline), you couldn't set the box up with any linux tools, you would have to set up the logical volumes under Windows then boot into linux to see them. Since the LUN 0 device wasn't really offline, but instead was reported as a disk device with no attached physical device, this patch was created to allow the linux kernel to send commands to the control device.

Signature · 4 lines
  Doug Ledford <[email protected]>     919-754-3700 x44233
         Red Hat, Inc.
         1801 Varsity Dr.
         Raleigh, NC 27606
#5 lore raw
Quoted 9 lines · Doug Ledford

Actually, the original reason for the patch was the fact that some external boxes use LUN 0 as a control device that you send commands to in order to init logical volumes. Without access to the control device (which previously was always shown as offline), you couldn't set the box up with any linux tools, you would have to set up the logical volumes under Windows then boot into linux to see them. Since the LUN 0 device wasn't really offline, but instead was reported as a disk device with no attached physical device, this patch was created to allow the linux kernel to send commands to the control device.

Man is that a horrible cludge. Can't one of the EMC folks on this list kick their firmware group to fix this horrible crap? I.e. make lun a non-disk device that can be accessed by sg and isn't marked offline? It can't be _that_ difficult. And btw, what tools actually need that access, does some have pointers to a tarball - I really wonder what they do.

Yeah, Enterprise storage. I wonder why people trust EMC to even design a loo cover.

#6 lore raw
Quoted 2 lines · Christoph Hellwig

Yeah, Enterprise storage. I wonder why people trust EMC to even design a loo cover.

Enterprise storage is like an Enterprise kernel -- stuffed with all kinds of shit that nobody in their right mind would want.

Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain
#7 lore raw

Here's EMC's post in the archives describing the original problem:

http://marc.theaimsgroup.com/?t=99790431900006&r=1&w=2

A better method is to not mark it offline, and have sd_probe not attach based on the PQ fields, like Mike Anderson and (I thought) Doug Ledford had proposed:

http://marc.theaimsgroup.com/?l=linux-scsi&m=99837483305810&w=2

Above patch should be modified to check the scsi_device inquiry data rather than store the PQ separately. This method also means we don't have offlined devices showing up under sd.

-- Patrick Mansfield