Skip to contentSkip to conversation

target: make sure the np under each tpg is unique

PATCH In review [email protected] 2 participants 2 messages Jan 11, 2022 – Jan 13, 2022

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

PATCH 1/1 target: make sure the np under each tpg is unique

From: ZouMingzhe <[email protected]>

iscsit_tpg_check_network_portal() has two-layer for loop, and should return true When a match is found. Then, the tpg loop will still continue after break the tpg_np loop. If this tpg_np is not the last, the match value will be changed.

This patch break all loops after finding a match, and make sure the np under each tpg is unique.

---
 drivers/target/iscsi/iscsi_target_tpg.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/target/iscsi/iscsi_target_tpg.c +3 -0
index 8075f60fd02c..2d5cf1714ae0 100644
@@ -443,6 +443,9 @@ static bool iscsit_tpg_check_network_portal(
 				break;
 		}
 		spin_unlock(&tpg->tpg_np_lock);
+
+		if (match)
+			break;
 	}
 	spin_unlock(&tiqn->tiqn_tpg_lock);
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · On 1/10/22 11:45 PM, [email protected] wrote:

From: ZouMingzhe <[email protected]>

iscsit_tpg_check_network_portal() has two-layer for loop, and should return true When a match is found. Then, the tpg loop will still continue after break the tpg_np loop. If this tpg_np is not the last, the match value will be changed.

This patch break all loops after finding a match, and make sure the np under each tpg is unique.

---
 drivers/target/iscsi/iscsi_target_tpg.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/target/iscsi/iscsi_target_tpg.c +0 -0
index 8075f60fd02c..2d5cf1714ae0 100644

drivers/target/iscsi/iscsi_target_tpg.c static bool iscsit_tpg_check_network_portal( · line 451

Quoted 9 lines
drivers/target/iscsi/iscsi_target_tpg.c +3 -0
@@ -443,6 +443,9 @@ static bool iscsit_tpg_check_network_portal(
 				break;
 		}
 		spin_unlock(&tpg->tpg_np_lock);
+
+		if (match)
+			break;
 	}
 	spin_unlock(&tiqn->tiqn_tpg_lock);