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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux