All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Limit max_luns to 16k
@ 2006-07-04  8:18 Hannes Reinecke
  0 siblings, 0 replies; only message in thread
From: Hannes Reinecke @ 2006-07-04  8:18 UTC (permalink / raw)
  To: SCSI Mailing List; +Cc: David Wagner, James Smart

[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]

Hi all,

I have encountered a really nice aliasing error in the SCSI stack.
(I only hope Luben is not reading this, it'll be just the thing he'd 
want to hear :-)

Some device allow for a max lun number larger than 16k.
Eg qla2xxx has this:

#define MAX_FIBRE_LUNS         0xFFFF

If we encounter a SCSI-2 device with has
BLIST_SPARSELUN | BLIST_LARGELUN
set we'll end up doing a sequential scan of all 64k luns.

However, according to SAM the top two bits are reserved for hierarchical 
addressing. So if we're using a lun _number_ larger than 16k we'll 
infact are using the flat addressing model of the LUN with mask 0xC000.

So essentially a device at LUN 0x0 will be aliased to LUN 0xC000 et al 
and hence will be seen detected several times from SCSI ML.

The easy way out here is to _not_ scan past 16k; this will 'fix' this 
issue. Affected drivers are qla2xxx and lpfc.

However, I feel in the long run we should at least detect hierarchical 
luns and issue a warning there. Just think of hierarchical LUNs being 
returned from REPORT_LUNS ...

Signed-off-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes

-- 
Dr. Hannes Reinecke			hare@suse.de
SuSE Linux Products GmbH		S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de

[-- Attachment #2: limit-luns-to-16k --]
[-- Type: text/plain, Size: 1090 bytes --]

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index b62a72d..af4dd6f 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -696,10 +696,10 @@ LPFC_ATTR(discovery_threads, 32, 1, 64, 
 
 /*
 # lpfc_max_luns: maximum number of LUNs per target driver will support
-# Value range is [1,32768]. Default value is 256.
+# Value range is [1,16384]. Default value is 256.
 # NOTE: The SCSI layer will scan each target for this many luns
 */
-LPFC_ATTR_R(max_luns, 256, 1, 32768,
+LPFC_ATTR_R(max_luns, 256, 1, 16384,
 	     "Maximum number of LUNs per target driver will support");
 
 /*
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 139ea0e..3183ad7 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -119,7 +119,7 @@ #define WRT_REG_WORD_PIO(addr, data)	(ou
  */
 #define WWN_SIZE		8	/* Size of WWPN, WWN & WWNN */
 #define MAX_FIBRE_DEVICES	512
-#define MAX_FIBRE_LUNS  	0xFFFF
+#define MAX_FIBRE_LUNS  	0x3FFF
 #define	MAX_RSCN_COUNT		32
 #define	MAX_HOST_COUNT		16
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-07-04  8:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-04  8:18 [PATCH] Limit max_luns to 16k Hannes Reinecke

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.