This is a note to let you know that I've just added the patch titled scsi_scan: Restrict sequential scan to 256 LUNs to the 3.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: scsi_scan-restrict-sequential-scan-to-256-luns.patch and it can be found in the queue-3.16 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 22ffeb48b7584d6cd50f2a595ed6065d86a87459 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke <hare@xxxxxxx> Date: Tue, 3 Jun 2014 10:58:53 +0200 Subject: scsi_scan: Restrict sequential scan to 256 LUNs From: Hannes Reinecke <hare@xxxxxxx> commit 22ffeb48b7584d6cd50f2a595ed6065d86a87459 upstream. 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@xxxxxxx> Reviewed-by: Ewan Milne <emilne@xxxxxxxxxx> Signed-off-by: Christoph Hellwig <hch@xxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/scsi/scsi_scan.c | 6 ++++++ include/scsi/scsi_devinfo.h | 2 ++ 2 files changed, 8 insertions(+) --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1239,6 +1239,12 @@ static void scsi_sequential_lun_scan(str 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. --- 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 Patches currently in stable-queue which might be from hare@xxxxxxx are queue-3.16/drivers-scsi-storvsc-implement-a-eh_timed_out-handler.patch queue-3.16/drivers-scsi-storvsc-correctly-handle-test_unit_ready-failure.patch queue-3.16/drivers-scsi-storvsc-set-srb_flags-in-all-cases.patch queue-3.16/drivers-scsi-storvsc-fix-a-bug-in-handling-vmbus-protocol-version.patch queue-3.16/scsi-save-command-pool-address-of-scsi_host.patch queue-3.16/drivers-scsi-storvsc-change-the-limits-to-reflect-the-values-on-the-host.patch queue-3.16/drivers-scsi-storvsc-filter-commands-based-on-the-storage-protocol-version.patch queue-3.16/drivers-scsi-storvsc-set-cmd_per_lun-to-reflect-value-supported-by-the-host.patch queue-3.16/scsi_scan-restrict-sequential-scan-to-256-luns.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html