Commit 004d9a45 authored by Roland Dreier's avatar Roland Dreier Committed by Luis Henriques

target: REPORT LUNS should return LUN 0 even for dynamic ACLs

commit 9c395170 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: default avatarRoland Dreier <roland@purestorage.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 96e14930
...@@ -1238,11 +1238,8 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd) ...@@ -1238,11 +1238,8 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd)
* coming via a target_core_mod PASSTHROUGH op, and not through * coming via a target_core_mod PASSTHROUGH op, and not through
* a $FABRIC_MOD. In that case, report LUN=0 only. * a $FABRIC_MOD. In that case, report LUN=0 only.
*/ */
if (!sess) { if (!sess)
int_to_scsilun(0, (struct scsi_lun *)&buf[offset]);
lun_count = 1;
goto done; goto done;
}
spin_lock_irq(&sess->se_node_acl->device_list_lock); spin_lock_irq(&sess->se_node_acl->device_list_lock);
for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) { for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) {
...@@ -1267,6 +1264,14 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd) ...@@ -1267,6 +1264,14 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd)
* See SPC3 r07, page 159. * See SPC3 r07, page 159.
*/ */
done: 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; lun_count *= 8;
buf[0] = ((lun_count >> 24) & 0xff); buf[0] = ((lun_count >> 24) & 0xff);
buf[1] = ((lun_count >> 16) & 0xff); buf[1] = ((lun_count >> 16) & 0xff);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment