All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target: make sure the np under each tpg is unique
@ 2022-01-11  5:47 mingzhe.zou
  2022-01-19  3:32 ` Martin K. Petersen
  2022-01-25  5:40 ` Martin K. Petersen
  0 siblings, 2 replies; 5+ messages in thread
From: mingzhe.zou @ 2022-01-11  5:47 UTC (permalink / raw)
  To: martin.petersen; +Cc: target-devel, linux-scsi, ZouMingzhe

From: ZouMingzhe <mingzhe.zou@easystack.cn>

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.

Signed-off-by: ZouMingzhe <mingzhe.zou@easystack.cn>
---
 drivers/target/iscsi/iscsi_target_tpg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c
index 8075f60fd02c..2d5cf1714ae0 100644
--- a/drivers/target/iscsi/iscsi_target_tpg.c
+++ b/drivers/target/iscsi/iscsi_target_tpg.c
@@ -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);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] target: make sure the np under each tpg is unique
  2022-01-11  5:47 [PATCH] target: make sure the np under each tpg is unique mingzhe.zou
@ 2022-01-19  3:32 ` Martin K. Petersen
  2022-01-25  5:40 ` Martin K. Petersen
  1 sibling, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2022-01-19  3:32 UTC (permalink / raw)
  To: mingzhe.zou; +Cc: martin.petersen, target-devel, linux-scsi


> 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.

Applied to 5.17/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] target: make sure the np under each tpg is unique
  2022-01-11  5:47 [PATCH] target: make sure the np under each tpg is unique mingzhe.zou
  2022-01-19  3:32 ` Martin K. Petersen
@ 2022-01-25  5:40 ` Martin K. Petersen
  1 sibling, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2022-01-25  5:40 UTC (permalink / raw)
  To: mingzhe.zou; +Cc: Martin K . Petersen, linux-scsi, target-devel

On Tue, 11 Jan 2022 13:47:42 +0800, mingzhe.zou@easystack.cn wrote:

> From: ZouMingzhe <mingzhe.zou@easystack.cn>
> 
> 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.
> 
> [...]

Applied to 5.17/scsi-fixes, thanks!

[1/1] target: make sure the np under each tpg is unique
      https://git.kernel.org/mkp/scsi/c/a861790afaa8

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] target: make sure the np under each tpg is unique
  2022-01-11  5:45 mingzhe.zou
@ 2022-01-13  1:20 ` Mike Christie
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Christie @ 2022-01-13  1:20 UTC (permalink / raw)
  To: mingzhe.zou, martin.petersen; +Cc: target-devel, linux-scsi

On 1/10/22 11:45 PM, mingzhe.zou@easystack.cn wrote:
> From: ZouMingzhe <mingzhe.zou@easystack.cn>
> 
> 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.
> 
> Signed-off-by: ZouMingzhe <mingzhe.zou@easystack.cn>
> ---
>  drivers/target/iscsi/iscsi_target_tpg.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c
> index 8075f60fd02c..2d5cf1714ae0 100644
> --- a/drivers/target/iscsi/iscsi_target_tpg.c
> +++ b/drivers/target/iscsi/iscsi_target_tpg.c
> @@ -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);
>  

Reviewed-by: Mike Christie <michael.christie@oracle.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] target: make sure the np under each tpg is unique
@ 2022-01-11  5:45 mingzhe.zou
  2022-01-13  1:20 ` Mike Christie
  0 siblings, 1 reply; 5+ messages in thread
From: mingzhe.zou @ 2022-01-11  5:45 UTC (permalink / raw)
  To: martin.petersen; +Cc: target-devel, linux-scsi

From: ZouMingzhe <mingzhe.zou@easystack.cn>

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.

Signed-off-by: ZouMingzhe <mingzhe.zou@easystack.cn>
---
 drivers/target/iscsi/iscsi_target_tpg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c
index 8075f60fd02c..2d5cf1714ae0 100644
--- a/drivers/target/iscsi/iscsi_target_tpg.c
+++ b/drivers/target/iscsi/iscsi_target_tpg.c
@@ -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);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-25  5:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11  5:47 [PATCH] target: make sure the np under each tpg is unique mingzhe.zou
2022-01-19  3:32 ` Martin K. Petersen
2022-01-25  5:40 ` Martin K. Petersen
  -- strict thread matches above, loose matches on Subject: below --
2022-01-11  5:45 mingzhe.zou
2022-01-13  1:20 ` Mike Christie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.