multipath-tools: intermittent IO error accounting to improve reliability
PATCH v2 1/1 multipath-tools: intermittent IO error accounting to improve reliability
This patch adds a new method of path state checking based on accounting IO error. This is useful in many scenarios such as intermittent IO error an a path due to network congestion, or a shaky link.
Three parameters are added for the admin: "path_io_err_sample_time", "path_io_err_rate_threshold" and "path_io_err_recovery_time". If path_io_err_sample_time and path_io_err_recovery_time are set to a value greater than 0, when a path fail event occurs due to an IO error, multipathd will enqueue this path into a queue of which each member is sent a couple of continous direct reading asynchronous io at a fixed sample rate of 10HZ. The IO accounting process for a path will last for path_io_err_sample_time. If the IO error rate on a particular path is greater than the path_io_err_rate_threshold, then the path will not reinstate for recover_time seconds unless there is only one active path.
If recover_time expires, we will reschedule this IO error checking process. If the path is good enough, we will claim it good.
This helps us place the path in delayed state if we hit a lot of intermittent IO errors on a particular path due to network/target issues and isolate such degraded path and allow the admin to rectify the errors on a path.
---
changes from V1:
* send continous IO instead of a single IO in a sample interval (Martin)
* when recover time expires, we reschedule the checking process (Hannes)
* Use the error rate threshold as a permillage instead of IO number(Martin)
* Use a common io_context for libaio for all paths (Martin)
* Other small fixes (Martin)
libmultipath/Makefile | 5 +- libmultipath/config.h | 9 + libmultipath/configure.c | 3 + libmultipath/dict.c | 41 +++ libmultipath/io_err_stat.c | 709 +++++++++++++++++++++++++++++++++++++++++++++ libmultipath/io_err_stat.h | 15 + libmultipath/propsel.c | 53 ++++ libmultipath/propsel.h | 3 + libmultipath/structs.h | 7 + libmultipath/uevent.c | 36 ++- libmultipath/uevent.h | 2 + multipath/multipath.conf.5 | 43 +++ multipathd/main.c | 56 ++++ 13 files changed, 978 insertions(+), 4 deletions(-) create mode 100644 libmultipath/io_err_stat.c create mode 100644 libmultipath/io_err_stat.h
libmultipath/Makefile +3 -2
@@ -9,7 +9,7 @@ LIBS = $(DEVLIB).$(SONAME) CFLAGS += $(LIB_CFLAGS) -I$(mpathcmddir) -LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd -lurcu +LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd -lurcu -laio ifdef SYSTEMD CFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
@@ -42,7 +42,8 @@ OBJS = memory.o parser.o vector.o devmapper.o callout.o \ pgpolicies.o debug.o defaults.o uevent.o time-util.o \ switchgroup.o uxsock.o print.o alias.o log_pthread.o \ log.o configure.o structs_vec.o sysfs.o prio.o checkers.o \ - lock.o waiter.o file.o wwids.o prioritizers/alua_rtpg.o + lock.o waiter.o file.o wwids.o prioritizers/alua_rtpg.o \ + io_err_stat.o all: $(LIBS)
libmultipath/config.h +9 -0
@@ -75,6 +75,9 @@ struct hwentry {int san_path_err_threshold;int san_path_err_forget_rate;int san_path_err_recovery_time; +int path_io_err_sample_time; +int path_io_err_rate_threshold; +int path_io_err_recovery_time;int skip_kpartx;int max_sectors_kb;char * bl_product;
@@ -106,6 +109,9 @@ struct mpentry {int san_path_err_threshold;int san_path_err_forget_rate;int san_path_err_recovery_time; +int path_io_err_sample_time; +int path_io_err_rate_threshold; +int path_io_err_recovery_time;int skip_kpartx;int max_sectors_kb;uid_t uid;
@@ -155,6 +161,9 @@ struct config {int san_path_err_threshold;int san_path_err_forget_rate;int san_path_err_recovery_time; +int path_io_err_sample_time; +int path_io_err_rate_threshold; +int path_io_err_recovery_time;int uxsock_timeout;int strict_timing;int retrigger_tries;
libmultipath/configure.c +3 -0
@@ -298,6 +298,9 @@ int setup_map(struct multipath *mpp, char *params, int params_size)select_san_path_err_threshold (conf, mpp);select_san_path_err_forget_rate (conf, mpp);select_san_path_err_recovery_time (conf, mpp); +select_path_io_err_sample_time (conf, mpp); +select_path_io_err_rate_threshold (conf, mpp); +select_path_io_err_recovery_time (conf, mpp);select_skip_kpartx (conf, mpp);select_max_sectors_kb (conf, mpp);
libmultipath/dict.c +41 -0
71 lines not on this page · raw message
libmultipath/io_err_stat.c new file +709 -0
709 lines not on this page · raw message
libmultipath/io_err_stat.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef _IO_ERR_STAT_H +#define _IO_ERR_STAT_H + +#include "vector.h" +#include "lock.h" + + +extern pthread_attr_t io_err_stat_attr; + +int start_io_err_stat_thread (void *data); +void stop_io_err_stat_thread (void ); +int io_err_stat_handle_pathfail (struct path *path); +int hit_io_err_recovery_time (struct path *pp); + +#endif /* _IO_ERR_STAT_H */
libmultipath/propsel.c +53 -0
71 lines not on this page · raw message
libmultipath/propsel.h +3 -0
@@ -28,6 +28,9 @@ int select_max_sectors_kb (struct config *conf, struct multipath * mp);int select_san_path_err_forget_rate (struct config *conf,struct multipath *mp);int select_san_path_err_threshold (struct config *conf,struct multipath *mp);int select_san_path_err_recovery_time (struct config *conf,struct multipath *mp); +int select_path_io_err_sample_time (struct config *conf,struct multipath *mp); +int select_path_io_err_rate_threshold (struct config *conf,struct multipath *mp); +int select_path_io_err_recovery_time (struct config *conf,struct multipath *mp);void reconcile_features_with_options (const char *id,char **features,int * no_path_retry,int *retain_hwhandler);
libmultipath/structs.h +7 -0
@@ -235,6 +235,10 @@ struct path {time_t dis_reinstate_time;int disable_reinstate;int san_path_err_forget_rate; +time_t io_err_dis_reinstate_time; +int io_err_disable_reinstate; +int io_err_pathfail_cnt; +int io_err_pathfail_starttime;/* configlet pointers */ struct hwentry * hwe; };
@@ -269,6 +273,9 @@ struct multipath {int san_path_err_threshold;int san_path_err_forget_rate;int san_path_err_recovery_time; +int path_io_err_sample_time; +int path_io_err_rate_threshold; +int path_io_err_recovery_time;int skip_kpartx;int max_sectors_kb;int force_readonly;
libmultipath/uevent.c +34 -2
@@ -904,8 +904,8 @@ char *uevent_get_dm_name(struct uevent *uev)int i;for (i =0 ; uev->envp[i] !=NULL ; i++) { -if (!strncmp (uev->envp[i],"DM_NAME" ,6 ) && -strlen (uev->envp[i]) >7 ) { +if (!strncmp (uev->envp[i],"DM_NAME" ,7 ) && +strlen (uev->envp[i]) >8 ) { p =MALLOC (strlen (uev->envp[i] +8 ) +1 );strcpy (p, uev->envp[i] +8 );break ;
@@ -913,3 +913,35 @@ char *uevent_get_dm_name(struct uevent *uev) }return p; } + +char *uevent_get_dm_path (struct uevent *uev) +{ +char *p =NULL ; +int i; + +for (i =0 ; uev->envp[i] !=NULL ; i++) { +if (!strncmp (uev->envp[i],"DM_PATH" ,7 ) && +strlen (uev->envp[i]) >8 ) { + p =MALLOC (strlen (uev->envp[i] +8 ) +1 ); +strcpy (p, uev->envp[i] +8 ); +break ; + } + } +return p; +} + +char *uevent_get_dm_action (struct uevent *uev) +{ +char *p =NULL ; +int i; + +for (i =0 ; uev->envp[i] !=NULL ; i++) { +if (!strncmp (uev->envp[i],"DM_ACTION" ,9 ) && +strlen (uev->envp[i]) >10 ) { + p =MALLOC (strlen (uev->envp[i] +10 ) +1 ); +strcpy (p, uev->envp[i] +10 ); +break ; + } + } +return p; +}
libmultipath/uevent.h +2 -0
@@ -37,5 +37,7 @@ int uevent_get_major(struct uevent *uev);int uevent_get_minor (struct uevent *uev);int uevent_get_disk_ro (struct uevent *uev);char *uevent_get_dm_name (struct uevent *uev); +char *uevent_get_dm_path (struct uevent *uev); +char *uevent_get_dm_action (struct uevent *uev);#endif /* _UEVENT_H */
multipath/multipath.conf.5 +43 -0
49 lines not on this page · raw message
multipathd/main.c +56 -0
110 lines not on this page · raw message
Signature · 1 line
2.11.1