Skip to contentSkip to conversation

target: respond to unknown initiators with sensible REPORT LUNS list length

PATCH In review Spencer Baugh 2 participants 2 messages Jul 22, 2015 – Jul 23, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target: respond to unknown initiators with sensible REPORT LUNS list length

From: Roland Dreier <[email protected]>

Solaris seems to go beserk if we respond to REPORT LUNS with a LUN LIST LENGTH of 0.

---
 drivers/target/target_core_spc.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/target/target_core_spc.c +7 -0
index 87d4adb..d8a32e5 100644
@@ -1241,6 +1241,13 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd)
 	 * See SPC3 r07, page 159.
 	 */
 done:
+	/*
+	 * If no real LUNs are accessible, report an allocation length
+	 * of 1 LUN to account for virtual LUN 0.
+	 */
+	if (lun_count == 0)
+		lun_count = 1;
+
 	lun_count *= 8;
 	buf[0] = ((lun_count >> 24) & 0xff);
 	buf[1] = ((lun_count >> 16) & 0xff);
Signature · 1 line
2.5.0.rc3
#1 lore raw

drivers/target/target_core_spc.c sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd) · line 1250

Quoted 8 lines · Spencer Baugh

done:

drivers/target/target_core_spc.c +7 -0
+	/*
+	 * If no real LUNs are accessible, report an allocation length
+	 * of 1 LUN to account for virtual LUN 0.
+	 */
+	if (lun_count == 0)
+		lun_count = 1;
+

Shouldn't the code actually report the virtual lun zero instead of just accounting for it?