aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2015-07-24 15:11:46 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2015-08-03 01:12:18 -0400
commit9c395170a559d3b23dad100b01fc4a89d661c698 (patch)
tree7a01681b8a361ba846506e349b85eff07948acd5
parent9547308bda296b6f69876c840a0291fcfbeddbb8 (diff)
target: REPORT LUNS should return LUN 0 even for dynamic ACLs
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> Cc: <stable@vger.kernel.org> # v3.1+ Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/target_core_spc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index b5ba1ec3c354..556ea1b2cdd8 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -1221,11 +1221,9 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd)
1221 * coming via a target_core_mod PASSTHROUGH op, and not through 1221 * coming via a target_core_mod PASSTHROUGH op, and not through
1222 * a $FABRIC_MOD. In that case, report LUN=0 only. 1222 * a $FABRIC_MOD. In that case, report LUN=0 only.
1223 */ 1223 */
1224 if (!sess) { 1224 if (!sess)
1225 int_to_scsilun(0, (struct scsi_lun *)&buf[offset]);
1226 lun_count = 1;
1227 goto done; 1225 goto done;
1228 } 1226
1229 nacl = sess->se_node_acl; 1227 nacl = sess->se_node_acl;
1230 1228
1231 rcu_read_lock(); 1229 rcu_read_lock();
@@ -1248,6 +1246,14 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd)
1248 * See SPC3 r07, page 159. 1246 * See SPC3 r07, page 159.
1249 */ 1247 */
1250done: 1248done:
1249 /*
1250 * If no LUNs are accessible, report virtual LUN 0.
1251 */
1252 if (lun_count == 0) {
1253 int_to_scsilun(0, (struct scsi_lun *)&buf[offset]);
1254 lun_count = 1;
1255 }
1256
1251 lun_count *= 8; 1257 lun_count *= 8;
1252 buf[0] = ((lun_count >> 24) & 0xff); 1258 buf[0] = ((lun_count >> 24) & 0xff);
1253 buf[1] = ((lun_count >> 16) & 0xff); 1259 buf[1] = ((lun_count >> 16) & 0xff);