All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dm-mpath: Enable hw_handler_params to take effect if hw_handler is the same between new and old
@ 2016-11-24  7:11 tang.junhui
  2016-11-24  7:11 ` [PATCH 2/2] dm-mpath: Remove useless retain_attached_hw_handler parameter tang.junhui
  2016-11-28 21:23 ` [PATCH 1/2] dm-mpath: Enable hw_handler_params to take effect if hw_handler is the same between new and old Mike Snitzer
  0 siblings, 2 replies; 7+ messages in thread
From: tang.junhui @ 2016-11-24  7:11 UTC (permalink / raw)
  To: snitzer, agk; +Cc: zhang.kai16, dm-devel, tang.junhui

From: "tang.junhui" <tang.junhui@zte.com.cn>

If the hardware handle which a device has already attached is the same
with m->hw_handler_name, m->hw_handler_params should not be ignored, but
be enabled to take effect.

Signed-off-by: tang.junhui <tang.junhui@zte.com.cn>
---
 drivers/md/dm-mpath.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 0caab4b..b1aba63 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -849,19 +849,23 @@ static struct pgpath *parse_path(struct dm_arg_set *as, struct path_selector *ps
 retain:
 		attached_handler_name = scsi_dh_attached_handler_name(q, GFP_KERNEL);
 		if (attached_handler_name) {
+			/* clear any hw_handler_params associated with
+			 * m->hw_handler_params if a different handler has
+			 * already been 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;
 		}
 	}
 
-- 
2.8.1.windows.1

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

end of thread, other threads:[~2016-11-29  1:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-24  7:11 [PATCH 1/2] dm-mpath: Enable hw_handler_params to take effect if hw_handler is the same between new and old tang.junhui
2016-11-24  7:11 ` [PATCH 2/2] dm-mpath: Remove useless retain_attached_hw_handler parameter tang.junhui
2016-11-28 21:39   ` Mike Snitzer
2016-11-28 21:42     ` Mike Snitzer
2016-11-29  0:28     ` Mike Snitzer
2016-11-29  1:22     ` tang.junhui
2016-11-28 21:23 ` [PATCH 1/2] dm-mpath: Enable hw_handler_params to take effect if hw_handler is the same between new and old Mike Snitzer

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.