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 <h...@suse.de>
---
 drivers/target/loopback/tcm_loop.c | 9 +++++++++
 1 file changed, 9 insertions(+)

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)) {
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to