dm mpath: check if scsi_dh module already loaded before trying to load
authorMike Snitzer <snitzer@redhat.com>
Sat, 12 May 2012 00:43:21 +0000 (01:43 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Sat, 12 May 2012 00:43:21 +0000 (01:43 +0100)
If the requested scsi_dh module is already loaded then skip
request_module().

Multipath table loads can hang in an unnecessary __request_module.

Reported-by: Ben Marzinski <bmarzins@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-mpath.c

index 922a3385eead41be43bafeac56a4e417ad7b919d..754f38f8a6922d94d425fcaef5d834a573851fd4 100644 (file)
@@ -718,8 +718,8 @@ static int parse_hw_handler(struct dm_arg_set *as, struct multipath *m)
                return 0;
 
        m->hw_handler_name = kstrdup(dm_shift_arg(as), GFP_KERNEL);
-       request_module("scsi_dh_%s", m->hw_handler_name);
-       if (scsi_dh_handler_exist(m->hw_handler_name) == 0) {
+       if (!try_then_request_module(scsi_dh_handler_exist(m->hw_handler_name),
+                                    "scsi_dh_%s", m->hw_handler_name)) {
                ti->error = "unknown hardware handler type";
                ret = -EINVAL;
                goto fail;