diff mbox

[5/8] tcm_loop: Rescan SCSI target on transport online

Message ID 1434620622-65391-6-git-send-email-hare@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Hannes Reinecke June 18, 2015, 9:43 a.m. UTC
Setting the transport status to 'online' needs to rescan the
target, as some devices might have been added while the transport
has been offline.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/target/loopback/tcm_loop.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox

Patch

diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 6c724dd..7db31f3 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -1082,7 +1082,16 @@  static ssize_t tcm_loop_tpg_store_transport_status(
 			struct tcm_loop_tpg, tl_se_tpg);
 
 	if (!strncmp(page, "online", 6)) {
+		int status = tl_tpg->tl_transport_status;
+
 		tl_tpg->tl_transport_status = TCM_TRANSPORT_ONLINE;
+		if (status != tl_tpg->tl_transport_status &&
+		    tl_tpg->tl_hba->tl_proto_id == SCSI_PROTOCOL_SAS) {
+			struct sas_rphy *rphy = tl_tpg->sas_rphy;
+
+			scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id,
+					 SCAN_WILD_CARD, 0);
+		}
 		return count;
 	}
 	if (!strncmp(page, "offline", 7)) {