aboutsummaryrefslogtreecommitdiff
path: root/drivers/md/dm-mpath.c
diff options
context:
space:
mode:
authorGravatar tang.junhui <tang.junhui@zte.com.cn> 2016-11-24 15:11:48 +0800
committerGravatar Mike Snitzer <snitzer@redhat.com> 2016-12-08 14:13:10 -0500
commit54cd640d20de46bb54747286ca19f3995be921f2 (patch)
treef443e59d05f1a1f8fa6dbfd1e2dacd858bc41453 /drivers/md/dm-mpath.c
parentdm crypt: add ability to use keys from the kernel key retention service (diff)
downloadlinux-54cd640d20de46bb54747286ca19f3995be921f2.tar.gz
linux-54cd640d20de46bb54747286ca19f3995be921f2.tar.bz2
linux-54cd640d20de46bb54747286ca19f3995be921f2.zip
dm mpath: use hw_handler_params if attached hw_handler is same as requested
Let the requested m->hw_handler_params be used if the attached hardware handler is the same handler as requested with m->hw_handler_name. Signed-off-by: tang.junhui <tang.junhui@zte.com.cn> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-mpath.c')
-rw-r--r--drivers/md/dm-mpath.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 0caab4bf3515..6400cffb986d 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -850,18 +850,22 @@ retain:
attached_handler_name = scsi_dh_attached_handler_name(q, GFP_KERNEL);
if (attached_handler_name) {
/*
+ * Clear any hw_handler_params associated with a
+ * handler that isn't already attached.
+ */
+ if (m->hw_handler_name && strcmp(attached_handler_name, m->hw_handler_name)) {
+ kfree(m->hw_handler_params);
+ m->hw_handler_params = NULL;
+ }
+
+ /*
* Reset hw_handler_name to match the attached handler
- * and clear any hw_handler_params associated with the
- * ignored handler.
*
* NB. This modifies the table line to show the actual
* handler instead of the original table passed in.
*/
kfree(m->hw_handler_name);
m->hw_handler_name = attached_handler_name;
-
- kfree(m->hw_handler_params);
- m->hw_handler_params = NULL;
}
}