libmultipath: Implement PATH_TIMEOUT
authorHannes Reinecke <hare@suse.de>
Tue, 16 Jul 2013 07:12:57 +0000 (09:12 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Tue, 16 Jul 2013 19:49:17 +0000 (21:49 +0200)
The tur checker might run into a timeout, eg when a command is
sent but the checker hasn't been able to receive a reply in time.
Use a specific 'PATH_TIMEOUT' state for these cases.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath/checkers.c
libmultipath/checkers.h
libmultipath/checkers/tur.c
libmultipath/discovery.c
libmultipath/print.c

index 01dafdd..47f5c68 100644 (file)
@@ -16,7 +16,8 @@ char *checker_state_names[] = {
       "up",
       "shaky",
       "ghost",
-      "pending"
+      "pending",
+      "timeout",
 };
 
 static LIST_HEAD(checkers);
index 5a96165..1b6c22d 100644 (file)
  * PATH_PENDING:
  * - Use: All async checkers
  * - Description: Indicates a check IO is in flight.
+ *
+ * PATH_TIMEOUT:
+ * - Use: Only tur checker
+ * - Description: Command timed out
  */
 enum path_check_state {
        PATH_WILD,
@@ -55,6 +59,7 @@ enum path_check_state {
        PATH_SHAKY,
        PATH_GHOST,
        PATH_PENDING,
+       PATH_TIMEOUT,
        PATH_MAX_STATE
 };
 
index 9c141aa..6f5d4d9 100644 (file)
@@ -297,7 +297,7 @@ libcheck_check (struct checker * c)
                                pthread_cancel(ct->thread);
                                ct->running = 0;
                                MSG(c, MSG_TUR_TIMEOUT);
-                               tur_status = PATH_DOWN;
+                               tur_status = PATH_TIMEOUT;
                                ct->state = PATH_UNCHECKED;
                        } else {
                                condlog(3, "%d:%d: tur checker not finished",
index 791584a..f6f182e 100644 (file)
@@ -1029,6 +1029,8 @@ pathinfo (struct path *pp, vector hwtable, int mask)
                        if (pp->state == PATH_UNCHECKED ||
                            pp->state == PATH_WILD)
                                goto blank;
+                       if (pp->state == PATH_TIMEOUT)
+                               pp->state = PATH_DOWN;
                } else {
                        condlog(3, "%s: path inaccessible", pp->dev);
                        pp->chkrstate = pp->state = path_state;
index 274f5e7..b6d08b7 100644 (file)
@@ -335,6 +335,10 @@ snprint_chk_state (char * buff, size_t len, struct path * pp)
                return snprintf(buff, len, "shaky");
        case PATH_GHOST:
                return snprintf(buff, len, "ghost");
+       case PATH_PENDING:
+               return snprintf(buff, len, "i/o pending");
+       case PATH_TIMEOUT:
+               return snprintf(buff, len, "i/o timeout");
        default:
                return snprintf(buff, len, "undef");
        }