target-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] scsi: target: alua: do not report emtpy port group
@ 2022-09-12 12:54 Dmitry Bogdanov
  2022-09-12 12:54 ` [PATCH v2] scsi: target: core: Set MULTIP bit for se_device with multiple ports Dmitry Bogdanov
  2022-09-12 17:49 ` [PATCH v2] scsi: target: alua: do not report emtpy port group Mike Christie
  0 siblings, 2 replies; 10+ messages in thread
From: Dmitry Bogdanov @ 2022-09-12 12:54 UTC (permalink / raw)
  To: Martin Petersen, target-devel
  Cc: Mike Christie, Bart Van Assche, linux-scsi, linux,
	Dmitry Bogdanov

Default target port group is always returned in the list of port
groups, even if the behaviour is unwanted, i.e. it has no members and
non-default port groups are primary port groups.

SPC-4 ("5.15.2.7 Target port asymmetric access state reporting")
states that a target MAY not provide info about port groups that do not
contain the current port through that the RTPG is received.

This patch hides port groups with no ports in REPORT TARGET PORT GROUPS
response.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
---
v2:
  new solution - just skip all empty groups
---
 drivers/target/target_core_alua.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index fb91423a4e2e..c8470e7c0e10 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -164,6 +164,9 @@ target_emulate_report_target_port_groups(struct se_cmd *cmd)
 	spin_lock(&dev->t10_alua.tg_pt_gps_lock);
 	list_for_each_entry(tg_pt_gp, &dev->t10_alua.tg_pt_gps_list,
 			tg_pt_gp_list) {
+		/* Skip empty port groups */
+		if (!tg_pt_gp->tg_pt_gp_members)
+			continue;
 		/*
 		 * Check if the Target port group and Target port descriptor list
 		 * based on tg_pt_gp_members count will fit into the response payload.
-- 
2.25.1


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

end of thread, other threads:[~2022-09-23 11:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-12 12:54 [PATCH v2] scsi: target: alua: do not report emtpy port group Dmitry Bogdanov
2022-09-12 12:54 ` [PATCH v2] scsi: target: core: Set MULTIP bit for se_device with multiple ports Dmitry Bogdanov
2022-09-12 17:50   ` Mike Christie
2022-09-16  1:40   ` Martin K. Petersen
2022-09-12 17:49 ` [PATCH v2] scsi: target: alua: do not report emtpy port group Mike Christie
2022-09-12 21:45   ` Dmitry Bogdanov
2022-09-14 19:18     ` Mike Christie
2022-09-15  6:08       ` Dmitry Bogdanov
2022-09-22 16:26         ` michael.christie
2022-09-23 11:38           ` Dmitry Bogdanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).