[Devel] [PATCH RHEL7 COMMIT] target: pass a device name to an alua user helper
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Jan 30 10:59:45 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.2
------>
commit 642e4bd842ec936349d374925d82495d69c83073
Author: Andrei Vagin <avagin at openvz.org>
Date: Tue Jan 30 10:59:44 2018 +0300
target: pass a device name to an alua user helper
Now the helper is executed with this list of arguments:
TG_PT_Group ID prev_state new_state {explicit/implicit} dev_name
For exmaple:
default_tg_pt_gp 0 Active/Optimized Standby explicit iqn.2014-06.com.vstorage:test-2
Signed-off-by: Andrei Vagin <avagin at openvz.org>
---
drivers/target/target_core_alua.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index a88a51d9b748..c59bf6960375 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -1028,13 +1028,14 @@ static void core_alua_do_transition_ua(struct t10_alua_tg_pt_gp *tg_pt_gp)
spin_unlock(&tg_pt_gp->tg_pt_gp_lock);
}
-static int core_alua_usermode_helper(struct t10_alua_tg_pt_gp *tg_pt_gp, int new_state, int explicit)
+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)
{
char *envp[] = { "HOME=/",
"TERM=linux",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
NULL };
- char *argv[7] = {}, str_id[6];
+ char *argv[8] = {}, str_id[6];
int ret;
if (!tg_pt_gp->tg_pt_gp_usermode_helper)
@@ -1057,7 +1058,8 @@ static int core_alua_usermode_helper(struct t10_alua_tg_pt_gp *tg_pt_gp, int new
argv[3] = core_alua_dump_state(tg_pt_gp->tg_pt_gp_alua_access_state);
argv[4] = core_alua_dump_state(new_state);
argv[5] = (explicit) ? "explicit" : "implicit";
- argv[6] = NULL;
+ argv[6] = config_item_name(&l_dev->dev_group.cg_item);
+ argv[7] = NULL;
ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC | UMH_KILLABLE);
pr_debug("helper command: %s exit code %u (0x%x)\n",
@@ -1068,12 +1070,13 @@ static int core_alua_usermode_helper(struct t10_alua_tg_pt_gp *tg_pt_gp, int new
static int core_alua_do_transition_tg_pt(
struct t10_alua_tg_pt_gp *tg_pt_gp,
+ struct se_device *l_dev,
int new_state,
int explicit)
{
int prev_state;
- if (core_alua_usermode_helper(tg_pt_gp, new_state, explicit))
+ if (core_alua_usermode_helper(tg_pt_gp, l_dev, new_state, explicit))
return -EAGAIN;
mutex_lock(&tg_pt_gp->tg_pt_gp_transition_mutex);
@@ -1181,7 +1184,7 @@ int core_alua_do_port_transition(
*/
l_tg_pt_gp->tg_pt_gp_alua_port = l_port;
l_tg_pt_gp->tg_pt_gp_alua_nacl = l_nacl;
- rc = core_alua_do_transition_tg_pt(l_tg_pt_gp,
+ rc = core_alua_do_transition_tg_pt(l_tg_pt_gp, l_dev,
new_state, explicit);
atomic_dec_mb(&lu_gp->lu_gp_ref_cnt);
return rc;
@@ -1230,7 +1233,7 @@ int core_alua_do_port_transition(
* core_alua_do_transition_tg_pt() will always return
* success.
*/
- rc = core_alua_do_transition_tg_pt(tg_pt_gp,
+ rc = core_alua_do_transition_tg_pt(tg_pt_gp, l_dev,
new_state, explicit);
spin_lock(&dev->t10_alua.tg_pt_gps_lock);
More information about the Devel
mailing list