From: Hannes Reinecke <hare@suse.de>
To: James Bottomley <jbottomley@parallels.com>
Cc: Christoph Hellwig <hch@infradead.org>,
Ewan Milne <emilne@redhat.com>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>
Subject: [PATCH 2/6] scsi_scan: Restrict sequential scan to 256 LUNs
Date: Sat, 31 May 2014 11:01:14 +0200 [thread overview]
Message-ID: <1401526878-119472-3-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1401526878-119472-1-git-send-email-hare@suse.de>
Sequential scan for more than 256 LUNs is very fragile as
LUNs might not be numbered sequentially after that point.
SAM revisions later than SCSI-3 impose a structure on
LUNs larger than 256, making LUN numbers between 256
and 16384 illegal.
SCSI-3, however allows for plain 64-bit numbers with
no internal structure.
So restrict sequential LUN scan to 256 LUNs and add a
new blacklist flag 'BLIST_SCSI3LUN' to scan up to
max_lun devices.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@infradead.org>
Reviewed-by: Ewan Milne <emilne@redhat.com>
---
drivers/scsi/scsi_scan.c | 6 ++++++
include/scsi/scsi_devinfo.h | 2 ++
2 files changed, 8 insertions(+)
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 8564bdc..a02f7b0 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1235,6 +1235,12 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget,
max_dev_lun = min(8U, max_dev_lun);
/*
+ * Stop scanning at 255 unless BLIST_SCSI3LUN
+ */
+ if (!(bflags & BLIST_SCSI3LUN))
+ max_dev_lun = min(256U, max_dev_lun);
+
+ /*
* We have already scanned LUN 0, so start at LUN 1. Keep scanning
* until we reach the max, or no LUN is found and we are not
* sparse_lun.
diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
index 447d2d7..8670c04 100644
--- a/include/scsi/scsi_devinfo.h
+++ b/include/scsi/scsi_devinfo.h
@@ -32,4 +32,6 @@
#define BLIST_ATTACH_PQ3 0x1000000 /* Scan: Attach to PQ3 devices */
#define BLIST_NO_DIF 0x2000000 /* Disable T10 PI (DIF) */
#define BLIST_SKIP_VPD_PAGES 0x4000000 /* Ignore SBC-3 VPD pages */
+#define BLIST_SCSI3LUN 0x8000000 /* Scan more than 256 LUNs
+ for sequential scan */
#endif
--
1.7.12.4
next prev parent reply other threads:[~2014-05-31 9:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-31 9:01 [PATCHv3 0/6] Support 64-bit LUNs Hannes Reinecke
2014-05-31 9:01 ` [PATCH 1/6] scsi: Remove CONFIG_SCSI_MULTI_LUN Hannes Reinecke
2014-05-31 9:01 ` Hannes Reinecke [this message]
2014-05-31 9:01 ` [PATCH 3/6] qla2xxx: Restrict max_lun to 16-bit for older HBAs Hannes Reinecke
2014-05-31 9:01 ` [PATCH 4/6] scsi: use 64-bit LUNs Hannes Reinecke
2014-06-02 16:13 ` Bart Van Assche
2014-05-31 9:01 ` [PATCH 5/6] scsi: use 64-bit value for 'max_luns' Hannes Reinecke
2014-05-31 9:01 ` [PATCH 6/6] scsi_scan: Fixup scsilun_to_int() Hannes Reinecke
2014-06-02 16:03 ` James Bottomley
2014-06-02 16:16 ` Bart Van Assche
2014-06-02 8:15 ` [PATCHv3 0/6] Support 64-bit LUNs Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2014-06-03 8:58 [PATCHv4 " Hannes Reinecke
2014-06-03 8:58 ` [PATCH 2/6] scsi_scan: Restrict sequential scan to 256 LUNs Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401526878-119472-3-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=emilne@redhat.com \
--cc=hch@infradead.org \
--cc=jbottomley@parallels.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).