[Devel] [PATCH RHEL7 COMMIT] target: call alua helper before reporting group states to initiator

Konstantin Khorenko khorenko at virtuozzo.com
Thu Feb 1 12:52:27 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.11.6.vz7.42.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.11.6.vz7.42.5
------>
commit 530d5853ba4fb59b22d3b58ab3da8dc43452ad3e
Author: Andrei Vagin <avagin at openvz.org>
Date:   Thu Feb 1 12:52:27 2018 +0300

    target: call alua helper before reporting group states to initiator
    
    An alua helper is called with the same set of arguments as it is called
    when a group state is changed, but the fourth argument will be "Read".
    
    For example:
     default_tg_pt_gp 0 Active/Optimized Read implicit iqn.2014-06.com.vstorage:test-1
    
    Signed-off-by: Andrei Vagin <avagin at openvz.org>
---
 drivers/target/target_core_alua.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index 46c8bebd14f1..f1c17335ac95 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -138,6 +138,8 @@ target_emulate_report_referrals(struct se_cmd *cmd)
 	return 0;
 }
 
+static int core_alua_usermode_helper(struct t10_alua_tg_pt_gp *tg_pt_gp,
+			struct se_device *l_dev, int new_state, int explicit);
 /*
  * REPORT_TARGET_PORT_GROUPS
  *
@@ -173,6 +175,8 @@ target_emulate_report_target_port_groups(struct se_cmd *cmd)
 	if (!buf)
 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 
+	core_alua_usermode_helper(dev->t10_alua.default_tg_pt_gp, dev, -1, 0);
+
 	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) {
@@ -1046,7 +1050,7 @@ static int core_alua_usermode_helper(struct t10_alua_tg_pt_gp *tg_pt_gp,
 	argv[1] = config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item);
 	argv[2] = str_id;
 	argv[3] = core_alua_dump_state(tg_pt_gp->tg_pt_gp_alua_access_state);
-	argv[4] = core_alua_dump_state(new_state);
+	argv[4] = new_state < 0 ? "Read" : core_alua_dump_state(new_state);
 	argv[5] = (explicit) ? "explicit" : "implicit";
 	argv[6] = config_item_name(&l_dev->dev_group.cg_item);
 	argv[7] = NULL;


More information about the Devel mailing list