diff options
author | Roland Dreier <roland@purestorage.com> | 2015-07-24 12:11:46 -0700 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2015-10-13 03:46:01 +0100 |
commit | 823713324fe26978a9c468b93a5af43444849a45 (patch) | |
tree | 373df7b990bb3e2c782cb2011f8ab71de5fccd12 | |
parent | 966b20a399e17a861527fb92b0411a5deb90ba18 (diff) | |
download | kernel_samsung_smdk4412-823713324fe26978a9c468b93a5af43444849a45.zip kernel_samsung_smdk4412-823713324fe26978a9c468b93a5af43444849a45.tar.gz kernel_samsung_smdk4412-823713324fe26978a9c468b93a5af43444849a45.tar.bz2 |
target: REPORT LUNS should return LUN 0 even for dynamic ACLs
commit 9c395170a559d3b23dad100b01fc4a89d661c698 upstream.
If an initiator doesn't have any real LUNs assigned, we should report
LUN 0 and a LUN list length of 1. Some versions of Solaris at least
go beserk if we report a LUN list length of 0.
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
[bwh: Backported to 3.2: adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | drivers/target/target_core_device.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 6993961..c3cf95e 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -668,11 +668,8 @@ int target_report_luns(struct se_task *se_task) * coming via a target_core_mod PASSTHROUGH op, and not through * a $FABRIC_MOD. In that case, report LUN=0 only. */ - if (!se_sess) { - int_to_scsilun(0, (struct scsi_lun *)&buf[offset]); - lun_count = 1; + if (!se_sess) goto done; - } spin_lock_irq(&se_sess->se_node_acl->device_list_lock); for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) { @@ -699,6 +696,14 @@ int target_report_luns(struct se_task *se_task) * See SPC3 r07, page 159. */ done: + /* + * If no LUNs are accessible, report virtual LUN 0. + */ + if (lun_count == 0) { + int_to_scsilun(0, (struct scsi_lun *)&buf[offset]); + lun_count = 1; + } + lun_count *= 8; buf[0] = ((lun_count >> 24) & 0xff); buf[1] = ((lun_count >> 16) & 0xff); |