<div dir="ltr">Applied,<div>Thanks.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 30, 2014 at 7:14 AM, Benjamin Marzinski <span dir="ltr"><<a href="mailto:bmarzins@redhat.com" target="_blank">bmarzins@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The multipath prioritizers can get stuck issuing scsi commands that<br>
don't return quickly, just like the checkers. So if checker_timeout<br>
is set, the prioritizers should should it for their cmd timeouts as<br>
well.<br>
<br>
Signed-off-by: Benjamin Marzinski <<a href="mailto:bmarzins@redhat.com">bmarzins@redhat.com</a>><br>
---<br>
 libmultipath/prio.c                   | 7 +++++++<br>
 libmultipath/prio.h                   | 1 +<br>
 libmultipath/prioritizers/alua_rtpg.c | 5 +++--<br>
 libmultipath/prioritizers/emc.c       | 2 +-<br>
 libmultipath/prioritizers/hds.c       | 2 +-<br>
 libmultipath/prioritizers/hp_sw.c     | 2 +-<br>
 libmultipath/prioritizers/ontap.c     | 4 ++--<br>
 libmultipath/prioritizers/rdac.c      | 2 +-<br>
 multipath.conf.annotated              | 5 +++--<br>
 multipath/multipath.conf.5            | 4 ++--<br>
 10 files changed, 22 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/libmultipath/prio.c b/libmultipath/prio.c<br>
index 05a8cf1..6ee0b9c 100644<br>
--- a/libmultipath/prio.c<br>
+++ b/libmultipath/prio.c<br>
@@ -10,6 +10,13 @@<br>
<br>
 static LIST_HEAD(prioritizers);<br>
<br>
+unsigned int get_prio_timeout(unsigned int default_timeout)<br>
+{<br>
+       if (conf->checker_timeout)<br>
+               return conf->checker_timeout * 1000;<br>
+       return default_timeout;<br>
+}<br>
+<br>
 int init_prio (void)<br>
 {<br>
        if (!add_prio(DEFAULT_PRIO))<br>
diff --git a/libmultipath/prio.h b/libmultipath/prio.h<br>
index 4eeb216..495688f 100644<br>
--- a/libmultipath/prio.h<br>
+++ b/libmultipath/prio.h<br>
@@ -51,6 +51,7 @@ struct prio {<br>
        int (*getprio)(struct path *, char *);<br>
 };<br>
<br>
+unsigned int get_prio_timeout(unsigned int default_timeout);<br>
 int init_prio (void);<br>
 void cleanup_prio (void);<br>
 struct prio * add_prio (char *);<br>
diff --git a/libmultipath/prioritizers/alua_rtpg.c b/libmultipath/prioritizers/alua_rtpg.c<br>
index 981ba06..6d04fc1 100644<br>
--- a/libmultipath/prioritizers/alua_rtpg.c<br>
+++ b/libmultipath/prioritizers/alua_rtpg.c<br>
@@ -21,6 +21,7 @@<br>
 #define __user<br>
 #include <scsi/sg.h><br>
<br>
+#include "../prio.h"<br>
 #include "alua_rtpg.h"<br>
<br>
 #define SENSE_BUFF_LEN  32<br>
@@ -134,7 +135,7 @@ do_inquiry(int fd, int evpd, unsigned int codepage, void *resp, int resplen)<br>
        hdr.dxfer_len           = resplen;<br>
        hdr.sbp                 = sense;<br>
        hdr.mx_sb_len           = sizeof(sense);<br>
-       hdr.timeout             = DEF_TIMEOUT;<br>
+       hdr.timeout             = get_prio_timeout(DEF_TIMEOUT);<br>
<br>
        if (ioctl(fd, SG_IO, &hdr) < 0) {<br>
                PRINT_DEBUG("do_inquiry: IOCTL failed!\n");<br>
@@ -253,7 +254,7 @@ do_rtpg(int fd, void* resp, long resplen)<br>
        hdr.dxfer_len           = resplen;<br>
        hdr.mx_sb_len           = sizeof(sense);<br>
        hdr.sbp                 = sense;<br>
-       hdr.timeout             = DEF_TIMEOUT;<br>
+       hdr.timeout             = get_prio_timeout(DEF_TIMEOUT);<br>
<br>
        if (ioctl(fd, SG_IO, &hdr) < 0)<br>
                return -RTPG_RTPG_FAILED;<br>
diff --git a/libmultipath/prioritizers/emc.c b/libmultipath/prioritizers/emc.c<br>
index 91b3d90..e49809c 100644<br>
--- a/libmultipath/prioritizers/emc.c<br>
+++ b/libmultipath/prioritizers/emc.c<br>
@@ -31,7 +31,7 @@ int emc_clariion_prio(const char *dev, int fd)<br>
        io_hdr.dxferp = sense_buffer;<br>
        io_hdr.cmdp = inqCmdBlk;<br>
        io_hdr.sbp = sb;<br>
-       io_hdr.timeout = 60000;<br>
+       io_hdr.timeout = get_prio_timeout(60000);<br>
        io_hdr.pack_id = 0;<br>
        if (ioctl(fd, SG_IO, &io_hdr) < 0) {<br>
                pp_emc_log(0, "sending query command failed");<br>
diff --git a/libmultipath/prioritizers/hds.c b/libmultipath/prioritizers/hds.c<br>
index f748707..8043b5b 100644<br>
--- a/libmultipath/prioritizers/hds.c<br>
+++ b/libmultipath/prioritizers/hds.c<br>
@@ -114,7 +114,7 @@ int hds_modular_prio (const char *dev, int fd)<br>
        io_hdr.dxferp = inqBuff;<br>
        io_hdr.cmdp = inqCmdBlk;<br>
        io_hdr.sbp = sense_buffer;<br>
-       io_hdr.timeout = 2000;  /* TimeOut = 2 seconds */<br>
+       io_hdr.timeout = get_prio_timeout(2000); /* TimeOut = 2 seconds */<br>
<br>
        if (ioctl (fd, SG_IO, &io_hdr) < 0) {<br>
                pp_hds_log(0, "SG_IO error");<br>
diff --git a/libmultipath/prioritizers/hp_sw.c b/libmultipath/prioritizers/hp_sw.c<br>
index c24baad..4950cf7 100644<br>
--- a/libmultipath/prioritizers/hp_sw.c<br>
+++ b/libmultipath/prioritizers/hp_sw.c<br>
@@ -46,7 +46,7 @@ int hp_sw_prio(const char *dev, int fd)<br>
        io_hdr.dxfer_direction = SG_DXFER_NONE;<br>
        io_hdr.cmdp = turCmdBlk;<br>
        io_hdr.sbp = sb;<br>
-       io_hdr.timeout = 60000;<br>
+       io_hdr.timeout = get_prio_timeout(60000);<br>
        io_hdr.pack_id = 0;<br>
  retry:<br>
        if (ioctl(fd, SG_IO, &io_hdr) < 0) {<br>
diff --git a/libmultipath/prioritizers/ontap.c b/libmultipath/prioritizers/ontap.c<br>
index 026d45d..5e82a17 100644<br>
--- a/libmultipath/prioritizers/ontap.c<br>
+++ b/libmultipath/prioritizers/ontap.c<br>
@@ -89,7 +89,7 @@ static int send_gva(const char *dev, int fd, unsigned char pg,<br>
        io_hdr.dxferp = results;<br>
        io_hdr.cmdp = cdb;<br>
        io_hdr.sbp = sb;<br>
-       io_hdr.timeout = SG_TIMEOUT;<br>
+       io_hdr.timeout = get_prio_timeout(SG_TIMEOUT);<br>
        io_hdr.pack_id = 0;<br>
        if (ioctl(fd, SG_IO, &io_hdr) < 0) {<br>
                pp_ontap_log(0, "SG_IO ioctl failed, errno=%d", errno);<br>
@@ -141,7 +141,7 @@ static int get_proxy(const char *dev, int fd)<br>
        io_hdr.dxferp = results;<br>
        io_hdr.cmdp = cdb;<br>
        io_hdr.sbp = sb;<br>
-       io_hdr.timeout = SG_TIMEOUT;<br>
+       io_hdr.timeout = get_prio_timeout(SG_TIMEOUT);<br>
        io_hdr.pack_id = 0;<br>
        if (ioctl(fd, SG_IO, &io_hdr) < 0) {<br>
                pp_ontap_log(0, "ioctl sending inquiry command failed, "<br>
diff --git a/libmultipath/prioritizers/rdac.c b/libmultipath/prioritizers/rdac.c<br>
index 2bf1443..a210055 100644<br>
--- a/libmultipath/prioritizers/rdac.c<br>
+++ b/libmultipath/prioritizers/rdac.c<br>
@@ -31,7 +31,7 @@ int rdac_prio(const char *dev, int fd)<br>
        io_hdr.dxferp = sense_buffer;<br>
        io_hdr.cmdp = inqCmdBlk;<br>
        io_hdr.sbp = sb;<br>
-       io_hdr.timeout = 60000;<br>
+       io_hdr.timeout = get_prio_timeout(60000);<br>
        io_hdr.pack_id = 0;<br>
        if (ioctl(fd, SG_IO, &io_hdr) < 0) {<br>
                pp_rdac_log(0, "sending inquiry command failed");<br>
diff --git a/multipath.conf.annotated b/multipath.conf.annotated<br>
index 235e130..f158746 100644<br>
--- a/multipath.conf.annotated<br>
+++ b/multipath.conf.annotated<br>
@@ -243,8 +243,9 @@<br>
 #      #<br>
 #      # name    : checker_timeout<br>
 #      # scope   : multipath & multipathd<br>
-#      # desc    : The timeout to use for path checkers that issue scsi<br>
-#      #           commands with an explicit timeout, in seconds.<br>
+#      # desc    : The timeout to use for path checkers and prioritizers<br>
+#      #           that issue scsi commands with an explicit timeout, in<br>
+#      #           seconds.<br>
 #      # values  : n > 0<br>
 #      # default : taken from /sys/block/sd<x>/device/timeout<br>
 #      checker_timeout 60<br>
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5<br>
index 1a904e9..195e663 100644<br>
--- a/multipath/multipath.conf.5<br>
+++ b/multipath/multipath.conf.5<br>
@@ -330,8 +330,8 @@ maximum number of open fds is taken from the calling process. It is usually<br>
 if that number is greated than 1024.<br>
 .TP<br>
 .B checker_timeout<br>
-Specify the timeout to user for path checkers that issue scsi commands with an<br>
-explicit timeout, in seconds; default taken from<br>
+Specify the timeout to use for path checkers and prioritizers that issue scsi<br>
+commands with an explicit timeout, in seconds; default taken from<br>
 .I /sys/block/sd<x>/device/timeout<br>
 .TP<br>
 .B fast_io_fail_tmo<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.1<br>
<br>
</font></span></blockquote></div><br></div>