]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
dm mpath: use hw_handler_params if attached hw_handler is same as requested
authortang.junhui <tang.junhui@zte.com.cn>
Thu, 24 Nov 2016 07:11:48 +0000 (15:11 +0800)
committerMike Snitzer <snitzer@redhat.com>
Thu, 8 Dec 2016 19:13:10 +0000 (14:13 -0500)
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>
drivers/md/dm-mpath.c

index 0caab4bf35155a0e28997dfcf43141cabb4f40e7..6400cffb986df21be7289dce8d2a4d4ff228a9a2 100644 (file)
@@ -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 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;
                }
        }