Update dev_loss_tmo for no_path_retry
authorHannes Reinecke <hare@suse.de>
Mon, 11 Jan 2010 14:06:08 +0000 (15:06 +0100)
committerHannes Reinecke <hare@suse.de>
Wed, 18 May 2011 08:10:52 +0000 (10:10 +0200)
When 'no_path_retry' is active we have to update the dev_loss_tmo
setting accordingly to ensure that no devices are removed during
an all-paths-down scenario.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath/defaults.h
libmultipath/discovery.c
libmultipath/structs_vec.c

index f268064..71aa6de 100644 (file)
@@ -18,6 +18,7 @@
 #define DEFAULT_CHECKINT       5
 #define MAX_CHECKINT(a)                (a << 2)
 
+#define MAX_DEV_LOSS_TMO       0x7FFFFFFF
 #define DEFAULT_PIDFILE                "/var/run/multipathd.pid"
 #define DEFAULT_SOCKET         "/var/run/multipathd.sock"
 #define DEFAULT_CONFIGFILE     "/etc/multipath.conf"
index a612fb8..0716c66 100644 (file)
@@ -26,6 +26,7 @@
 #include "sysfs.h"
 #include "discovery.h"
 #include "prio.h"
+#include "defaults.h"
 
 struct path *
 store_pathinfo (vector pathvec, vector hwtable, char * devname, int flag)
@@ -273,9 +274,31 @@ sysfs_set_scsi_tmo (struct multipath *mpp)
        int i;
        char value[11];
        int rport_id;
-
+       int dev_loss_tmo = mpp->dev_loss;
+
+       if (mpp->no_path_retry > 0) {
+               int no_path_retry_tmo = mpp->no_path_retry * conf->checkint;
+
+               if (no_path_retry_tmo > MAX_DEV_LOSS_TMO)
+                       no_path_retry_tmo = MAX_DEV_LOSS_TMO;
+               if (no_path_retry_tmo > dev_loss_tmo)
+                       dev_loss_tmo = no_path_retry_tmo;
+               condlog(3, "%s: update dev_loss_tmo to %d\n",
+                       mpp->alias, dev_loss_tmo);
+       } else if (mpp->no_path_retry == NO_PATH_RETRY_QUEUE) {
+               dev_loss_tmo = MAX_DEV_LOSS_TMO;
+               condlog(4, "%s: update dev_loss_tmo to %d\n",
+                       mpp->alias, dev_loss_tmo);
+       }
+       mpp->dev_loss = dev_loss_tmo;
+       if (mpp->fast_io_fail > mpp->dev_loss) {
+               mpp->fast_io_fail = mpp->dev_loss;
+               condlog(3, "%s: update fast_io_fail to %d\n",
+                       mpp->alias, mpp->fast_io_fail);
+       }
        if (!mpp->dev_loss && !mpp->fast_io_fail)
                return 0;
+
        vector_foreach_slot(mpp->paths, pp, i) {
                rport_id = find_rport_id(pp);
                if (rport_id < 0) {
index 8aad2b8..fa48e00 100644 (file)
@@ -460,6 +460,11 @@ verify_paths(struct multipath * mpp, struct vectors * vecs, vector rpvec)
        if (!mpp)
                return 0;
 
+       select_features(mpp);
+       select_no_path_retry(mpp);
+       select_dev_loss(mpp);
+       sysfs_set_scsi_tmo(mpp);
+
        vector_foreach_slot (mpp->paths, pp, i) {
                /*
                 * see if path is in sysfs