Updated to latest upstream 0.4.9 code : multipath-tools-120613.tgz

(git commit id: cb0f7127ba90ab5e8e71fc534a0a16cdbe96a88f)
Add 0001-RH-remove_callout.patch
  * multipath no longer uses the getuid callout.  It now gets the
    wwid from the udev database or the environment variables
Add 0004-RH-fix-cciss-names.patch
  * convert cciss device names from cciss/cXdY to sysfs style cciss!cXdY
Split 0009-RH-add-find-multipaths.patch into 0002-RH-add-wwids-file.patch
      and 0010-RH-add-find-multipaths.patch
Add 0016-RH-change-configs.patch
  * default fast_io_fail to 5 and don't set the path selector in the
    builtin configs.
Resolves: bz #831978
This commit is contained in:
Benjamin Marzinski 2012-06-28 12:41:03 -05:00
parent 5c6bc08dc8
commit 91daccef68
32 changed files with 1533 additions and 1890 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
multipath-tools-091027.tar.gz
/multipath-tools-120123.tgz
/multipath-tools-120613.tgz

View File

@ -1,242 +0,0 @@
---
libmultipath/checkers/tur.c | 85 +++++++++++++++++++++++++++++++++-----------
libmultipath/discovery.c | 1
2 files changed, 65 insertions(+), 21 deletions(-)
Index: multipath-tools-120123/libmultipath/checkers/tur.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/checkers/tur.c
+++ multipath-tools-120123/libmultipath/checkers/tur.c
@@ -35,10 +35,15 @@ struct tur_checker_context {
dev_t devt;
int state;
int running;
- time_t timeout;
+ int fd;
+ unsigned int timeout;
+ time_t time;
pthread_t thread;
pthread_mutex_t lock;
pthread_cond_t active;
+ pthread_spinlock_t hldr_lock;
+ int holders;
+ char message[CHECKER_MSG_LEN];
};
#define TUR_DEVT(c) major((c)->devt), minor((c)->devt)
@@ -53,28 +58,49 @@ int libcheck_init (struct checker * c)
memset(ct, 0, sizeof(struct tur_checker_context));
ct->state = PATH_UNCHECKED;
+ ct->fd = -1;
+ ct->holders = 1;
pthread_cond_init(&ct->active, NULL);
pthread_mutex_init(&ct->lock, NULL);
+ pthread_spin_init(&ct->hldr_lock, PTHREAD_PROCESS_PRIVATE);
c->context = ct;
return 0;
}
+void cleanup_context(struct tur_checker_context *ct)
+{
+ pthread_mutex_destroy(&ct->lock);
+ pthread_cond_destroy(&ct->active);
+ pthread_spin_destroy(&ct->hldr_lock);
+ free(ct);
+}
+
void libcheck_free (struct checker * c)
{
if (c->context) {
struct tur_checker_context *ct = c->context;
+ int holders;
+ pthread_t thread;
- pthread_mutex_destroy(&ct->lock);
- pthread_cond_destroy(&ct->active);
- free(c->context);
+ pthread_spin_lock(&ct->hldr_lock);
+ ct->holders--;
+ holders = ct->holders;
+ thread = ct->thread;
+ pthread_spin_unlock(&ct->hldr_lock);
+ if (holders)
+ pthread_cancel(thread);
+ else
+ cleanup_context(ct);
c->context = NULL;
}
return;
}
+#define TUR_MSG(msg, fmt, args...) snprintf(msg, CHECKER_MSG_LEN, fmt, ##args);
+
int
-tur_check (struct checker * c)
+tur_check(int fd, unsigned int timeout, char *msg)
{
struct sg_io_hdr io_hdr;
unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 };
@@ -90,10 +116,10 @@ tur_check (struct checker * c)
io_hdr.dxfer_direction = SG_DXFER_NONE;
io_hdr.cmdp = turCmdBlk;
io_hdr.sbp = sense_buffer;
- io_hdr.timeout = c->timeout;
+ io_hdr.timeout = timeout;
io_hdr.pack_id = 0;
- if (ioctl(c->fd, SG_IO, &io_hdr) < 0) {
- MSG(c, MSG_TUR_DOWN);
+ if (ioctl(fd, SG_IO, &io_hdr) < 0) {
+ TUR_MSG(msg, MSG_TUR_DOWN);
return PATH_DOWN;
}
if ((io_hdr.status & 0x7e) == 0x18) {
@@ -101,7 +127,7 @@ tur_check (struct checker * c)
* SCSI-3 arrays might return
* reservation conflict on TUR
*/
- MSG(c, MSG_TUR_UP);
+ TUR_MSG(msg, MSG_TUR_UP);
return PATH_UP;
}
if (io_hdr.info & SG_INFO_OK_MASK) {
@@ -146,14 +172,14 @@ tur_check (struct checker * c)
* LOGICAL UNIT NOT ACCESSIBLE,
* TARGET PORT IN STANDBY STATE
*/
- MSG(c, MSG_TUR_GHOST);
+ TUR_MSG(msg, MSG_TUR_GHOST);
return PATH_GHOST;
}
}
- MSG(c, MSG_TUR_DOWN);
+ TUR_MSG(msg, MSG_TUR_DOWN);
return PATH_DOWN;
}
- MSG(c, MSG_TUR_UP);
+ TUR_MSG(msg, MSG_TUR_UP);
return PATH_UP;
}
@@ -162,18 +188,25 @@ tur_check (struct checker * c)
void cleanup_func(void *data)
{
+ int holders;
struct tur_checker_context *ct = data;
+ pthread_spin_lock(&ct->hldr_lock);
+ ct->holders--;
+ holders = ct->holders;
ct->thread = 0;
+ pthread_spin_unlock(&ct->hldr_lock);
+ if (!holders)
+ cleanup_context(ct);
}
void *tur_thread(void *ctx)
{
- struct checker *c = ctx;
- struct tur_checker_context *ct = c->context;
+ struct tur_checker_context *ct = ctx;
int state;
condlog(3, "%d:%d: tur checker starting up", TUR_DEVT(ct));
+ ct->message[0] = '\0';
/* This thread can be canceled, so setup clean up */
tur_thread_cleanup_push(ct)
@@ -182,7 +215,7 @@ void *tur_thread(void *ctx)
ct->state = PATH_PENDING;
pthread_mutex_unlock(&ct->lock);
- state = tur_check(c);
+ state = tur_check(ct->fd, ct->timeout, ct->message);
/* TUR checker done */
pthread_mutex_lock(&ct->lock);
@@ -213,7 +246,7 @@ void tur_set_async_timeout(struct checke
struct timeval now;
gettimeofday(&now, NULL);
- ct->timeout = now.tv_sec + c->timeout;
+ ct->time = now.tv_sec + c->timeout;
}
int tur_check_async_timeout(struct checker *c)
@@ -222,7 +255,7 @@ int tur_check_async_timeout(struct check
struct timeval now;
gettimeofday(&now, NULL);
- return (now.tv_sec > ct->timeout);
+ return (now.tv_sec > ct->time);
}
extern int
@@ -242,7 +275,7 @@ libcheck_check (struct checker * c)
ct->devt = sb.st_rdev;
if (c->sync)
- return tur_check(c);
+ return tur_check(c->fd, c->timeout, c->message);
/*
* Async mode
@@ -276,6 +309,8 @@ libcheck_check (struct checker * c)
/* TUR checker done */
ct->running = 0;
tur_status = ct->state;
+ strncpy(c->message, ct->message, CHECKER_MSG_LEN);
+ c->message[CHECKER_MSG_LEN - 1] = '\0';
}
pthread_mutex_unlock(&ct->lock);
} else {
@@ -284,24 +319,32 @@ libcheck_check (struct checker * c)
pthread_mutex_unlock(&ct->lock);
condlog(3, "%d:%d: tur thread not responding, "
"using sync mode", TUR_DEVT(ct));
- return tur_check(c);
+ return tur_check(c->fd, c->timeout, c->message);
}
/* Start new TUR checker */
ct->state = PATH_UNCHECKED;
+ ct->fd = c->fd;
+ ct->timeout = c->timeout;
+ pthread_spin_lock(&ct->hldr_lock);
+ ct->holders++;
+ pthread_spin_unlock(&ct->hldr_lock);
tur_set_async_timeout(c);
setup_thread_attr(&attr, 32 * 1024, 1);
- r = pthread_create(&ct->thread, &attr, tur_thread, c);
+ r = pthread_create(&ct->thread, &attr, tur_thread, ct);
if (r) {
pthread_mutex_unlock(&ct->lock);
ct->thread = 0;
+ ct->holders--;
condlog(3, "%d:%d: failed to start tur thread, using"
" sync mode", TUR_DEVT(ct));
- return tur_check(c);
+ return tur_check(c->fd, c->timeout, c->message);
}
pthread_attr_destroy(&attr);
tur_timeout(&tsp);
r = pthread_cond_timedwait(&ct->active, &ct->lock, &tsp);
tur_status = ct->state;
+ strncpy(c->message, ct->message,CHECKER_MSG_LEN);
+ c->message[CHECKER_MSG_LEN -1] = '\0';
pthread_mutex_unlock(&ct->lock);
if (ct->thread &&
(tur_status == PATH_PENDING || tur_status == PATH_UNCHECKED)) {
Index: multipath-tools-120123/libmultipath/discovery.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/discovery.c
+++ multipath-tools-120123/libmultipath/discovery.c
@@ -842,6 +842,7 @@ get_state (struct path * pp, int daemon)
}
checker_set_fd(c, pp->fd);
if (checker_init(c, pp->mpp?&pp->mpp->mpcontext:NULL)) {
+ memset(c, 0x0, sizeof(struct checker));
condlog(3, "%s: checker init failed", pp->dev);
return PATH_UNCHECKED;
}

View File

@ -0,0 +1,279 @@
---
libmultipath/Makefile | 2
libmultipath/callout.c | 217 -----------------------------------------------
libmultipath/callout.h | 7 -
libmultipath/discovery.c | 1
multipathd/main.c | 1
5 files changed, 1 insertion(+), 227 deletions(-)
Index: multipath-tools-120518/libmultipath/Makefile
===================================================================
--- multipath-tools-120518.orig/libmultipath/Makefile
+++ multipath-tools-120518/libmultipath/Makefile
@@ -9,7 +9,7 @@ DEVLIB = libmultipath.so
LIBS = $(DEVLIB).$(SONAME)
LIBDEPS = -lpthread -ldl -ldevmapper -ludev
-OBJS = memory.o parser.o vector.o devmapper.o callout.o \
+OBJS = memory.o parser.o vector.o devmapper.o \
hwtable.o blacklist.o util.o dmparser.o config.o \
structs.o discovery.o propsel.o dict.o \
pgpolicies.o debug.o regex.o defaults.o uevent.o \
Index: multipath-tools-120518/libmultipath/callout.c
===================================================================
--- multipath-tools-120518.orig/libmultipath/callout.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Source: copy of the udev package source file
- *
- * Copyrights of the source file apply
- * Copyright (c) 2004 Christophe Varoqui
- */
-#include <stdio.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/wait.h>
-#include <errno.h>
-
-#include "checkers.h"
-#include "vector.h"
-#include "structs.h"
-#include "util.h"
-#include "debug.h"
-
-int execute_program(char *path, char *value, int len)
-{
- int retval;
- int count;
- int status;
- int fds[2], null_fd;
- pid_t pid;
- char *pos;
- char arg[CALLOUT_MAX_SIZE];
- int argc = sizeof(arg) / 2;
- char *argv[argc + 1];
- int i;
-
- i = 0;
-
- if (strchr(path, ' ')) {
- strlcpy(arg, path, sizeof(arg));
- pos = arg;
- while (pos != NULL && i < argc) {
- if (pos[0] == '\'') {
- /* don't separate if in apostrophes */
- pos++;
- argv[i] = strsep(&pos, "\'");
- while (pos[0] == ' ')
- pos++;
- } else {
- argv[i] = strsep(&pos, " ");
- }
- i++;
- }
- } else {
- argv[i++] = path;
- }
- argv[i] = NULL;
-
- retval = pipe(fds);
-
- if (retval != 0) {
- condlog(0, "error creating pipe for callout: %s", strerror(errno));
- return -1;
- }
-
- pid = fork();
-
- switch(pid) {
- case 0:
- /* child */
- close(STDOUT_FILENO);
-
- /* dup write side of pipe to STDOUT */
- if (dup(fds[1]) < 0)
- return -1;
-
- /* Ignore writes to stderr */
- null_fd = open("/dev/null", O_WRONLY);
- if (null_fd > 0) {
- close(STDERR_FILENO);
- dup(null_fd);
- close(null_fd);
- }
-
- retval = execv(argv[0], argv);
- condlog(0, "error execing %s : %s", argv[0], strerror(errno));
- exit(-1);
- case -1:
- condlog(0, "fork failed: %s", strerror(errno));
- close(fds[0]);
- close(fds[1]);
- return -1;
- default:
- /* parent reads from fds[0] */
- close(fds[1]);
- retval = 0;
- i = 0;
- while (1) {
- count = read(fds[0], value + i, len - i-1);
- if (count <= 0)
- break;
-
- i += count;
- if (i >= len-1) {
- condlog(0, "not enough space for response from %s", argv[0]);
- retval = -1;
- break;
- }
- }
-
- if (count < 0) {
- condlog(0, "no response from %s", argv[0]);
- retval = -1;
- }
-
- if (i > 0 && value[i-1] == '\n')
- i--;
- value[i] = '\0';
-
- wait(&status);
- close(fds[0]);
-
- retval = -1;
- if (WIFEXITED(status)) {
- status = WEXITSTATUS(status);
- if (status == 0)
- retval = 0;
- else
- condlog(0, "%s exitted with %d", argv[0], status);
- }
- else if (WIFSIGNALED(status))
- condlog(0, "%s was terminated by signal %d", argv[0], WTERMSIG(status));
- else
- condlog(0, "%s terminated abnormally", argv[0]);
- }
- return retval;
-}
-
-extern int
-apply_format (char * string, char * cmd, struct path * pp)
-{
- char * pos;
- char * dst;
- char * p;
- char * q;
- int len;
- int myfree;
-
- if (!string)
- return 1;
-
- if (!cmd)
- return 1;
-
- dst = cmd;
- p = dst;
- pos = strchr(string, '%');
- myfree = CALLOUT_MAX_SIZE;
-
- if (!pos) {
- strcpy(dst, string);
- return 0;
- }
-
- len = (int) (pos - string) + 1;
- myfree -= len;
-
- if (myfree < 2)
- return 1;
-
- snprintf(p, len, "%s", string);
- p += len - 1;
- pos++;
-
- switch (*pos) {
- case 'n':
- len = strlen(pp->dev) + 1;
- myfree -= len;
-
- if (myfree < 2)
- return 1;
-
- snprintf(p, len, "%s", pp->dev);
- for (q = p; q < p + len; q++) {
- if (q && *q == '!')
- *q = '/';
- }
- p += len - 1;
- break;
- case 'd':
- len = strlen(pp->dev_t) + 1;
- myfree -= len;
-
- if (myfree < 2)
- return 1;
-
- snprintf(p, len, "%s", pp->dev_t);
- p += len - 1;
- break;
- default:
- break;
- }
- pos++;
-
- if (!*pos)
- return 0;
-
- len = strlen(pos) + 1;
- myfree -= len;
-
- if (myfree < 2)
- return 1;
-
- snprintf(p, len, "%s", pos);
- condlog(3, "reformated callout = %s", dst);
- return 0;
-}
-
Index: multipath-tools-120518/libmultipath/callout.h
===================================================================
--- multipath-tools-120518.orig/libmultipath/callout.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _CALLOUT_H
-#define _CALLOUT_H
-
-int execute_program(char *, char *, int);
-int apply_format (char *, char *, struct path *);
-
-#endif /* _CALLOUT_H */
Index: multipath-tools-120518/libmultipath/discovery.c
===================================================================
--- multipath-tools-120518.orig/libmultipath/discovery.c
+++ multipath-tools-120518/libmultipath/discovery.c
@@ -20,7 +20,6 @@
#include "structs.h"
#include "config.h"
#include "blacklist.h"
-#include "callout.h"
#include "debug.h"
#include "propsel.h"
#include "sg_include.h"
Index: multipath-tools-120518/multipathd/main.c
===================================================================
--- multipath-tools-120518.orig/multipathd/main.c
+++ multipath-tools-120518/multipathd/main.c
@@ -35,7 +35,6 @@
#include <hwtable.h>
#include <defaults.h>
#include <structs.h>
-#include <callout.h>
#include <blacklist.h>
#include <structs_vec.h>
#include <dmparser.h>

View File

@ -1,24 +1,21 @@
---
libmultipath/Makefile | 2
libmultipath/alias.c | 151 ---------------------------------------
libmultipath/alias.c | 153 ---------------------------------------
libmultipath/alias.h | 1
libmultipath/config.c | 1
libmultipath/config.h | 1
libmultipath/configure.c | 14 +++
libmultipath/defaults.h | 2
libmultipath/dict.c | 34 ++++++++
libmultipath/file.c | 178 +++++++++++++++++++++++++++++++++++++++++++++++
libmultipath/configure.c | 3
libmultipath/defaults.h | 1
libmultipath/discovery.c | 2
libmultipath/file.c | 180 +++++++++++++++++++++++++++++++++++++++++++++++
libmultipath/file.h | 11 ++
libmultipath/finder.c | 165 +++++++++++++++++++++++++++++++++++++++++++
libmultipath/finder.h | 18 ++++
multipath/main.c | 4 -
multipathd/main.c | 6 +
14 files changed, 437 insertions(+), 151 deletions(-)
libmultipath/wwids.c | 139 ++++++++++++++++++++++++++++++++++++
libmultipath/wwids.h | 18 ++++
multipath/main.c | 37 ++++++++-
11 files changed, 389 insertions(+), 158 deletions(-)
Index: multipath-tools-111219/libmultipath/alias.c
Index: multipath-tools-120518/libmultipath/alias.c
===================================================================
--- multipath-tools-111219.orig/libmultipath/alias.c
+++ multipath-tools-111219/libmultipath/alias.c
--- multipath-tools-120518.orig/libmultipath/alias.c
+++ multipath-tools-120518/libmultipath/alias.c
@@ -3,19 +3,16 @@
* Copyright (c) 2005 Benjamin Marzinski, Redhat
*/
@ -40,7 +37,7 @@ Index: multipath-tools-111219/libmultipath/alias.c
/*
@@ -36,148 +33,6 @@
@@ -36,150 +33,6 @@
* See the file COPYING included with this distribution for more details.
*/
@ -173,7 +170,9 @@ Index: multipath-tools-111219/libmultipath/alias.c
- "Cannot write header to bindings file : %s",
- strerror(errno));
- /* cleanup partially written header */
- ftruncate(fd, 0);
- if (ftruncate(fd, 0))
- condlog(0, "Cannot truncate the header : %s",
- strerror(errno));
- goto fail;
- }
- fsync(fd);
@ -189,7 +188,7 @@ Index: multipath-tools-111219/libmultipath/alias.c
static int
format_devname(char *name, int id, int len, char *prefix)
@@ -366,7 +221,7 @@ get_user_friendly_alias(char *wwid, char
@@ -370,7 +223,7 @@ get_user_friendly_alias(char *wwid, char
return NULL;
}
@ -198,7 +197,7 @@ Index: multipath-tools-111219/libmultipath/alias.c
if (fd < 0)
return NULL;
@@ -416,7 +271,7 @@ get_user_friendly_wwid(char *alias, char
@@ -414,7 +267,7 @@ get_user_friendly_wwid(char *alias, char
return NULL;
}
@ -207,40 +206,28 @@ Index: multipath-tools-111219/libmultipath/alias.c
if (fd < 0)
return NULL;
Index: multipath-tools-111219/libmultipath/alias.h
Index: multipath-tools-120518/libmultipath/alias.h
===================================================================
--- multipath-tools-111219.orig/libmultipath/alias.h
+++ multipath-tools-111219/libmultipath/alias.h
--- multipath-tools-120518.orig/libmultipath/alias.h
+++ multipath-tools-120518/libmultipath/alias.h
@@ -1,4 +1,3 @@
-#define BINDINGS_FILE_TIMEOUT 30
#define BINDINGS_FILE_HEADER \
"# Multipath bindings, Version : 1.0\n" \
"# NOTE: this file is automatically maintained by the multipath program.\n" \
Index: multipath-tools-111219/libmultipath/config.c
Index: multipath-tools-120518/libmultipath/configure.c
===================================================================
--- multipath-tools-111219.orig/libmultipath/config.c
+++ multipath-tools-111219/libmultipath/config.c
@@ -504,6 +504,7 @@ load_config (char * file)
conf->reassign_maps = DEFAULT_REASSIGN_MAPS;
conf->checkint = DEFAULT_CHECKINT;
conf->max_checkint = MAX_CHECKINT(conf->checkint);
+ conf->find_multipaths = DEFAULT_FIND_MULTIPATHS;
/*
* preload default hwtable
Index: multipath-tools-111219/libmultipath/configure.c
===================================================================
--- multipath-tools-111219.orig/libmultipath/configure.c
+++ multipath-tools-111219/libmultipath/configure.c
@@ -36,6 +36,7 @@
--- multipath-tools-120518.orig/libmultipath/configure.c
+++ multipath-tools-120518/libmultipath/configure.c
@@ -37,6 +37,7 @@
#include "prio.h"
#include "util.h"
#include "uxsock.h"
+#include "finder.h"
+#include "wwids.h"
extern int
setup_map (struct multipath * mpp, char * params, int params_size)
@@ -405,6 +406,8 @@ domap (struct multipath * mpp, char * pa
@@ -407,6 +408,8 @@ domap (struct multipath * mpp, char * pa
* DM_DEVICE_CREATE, DM_DEVICE_RENAME, or DM_DEVICE_RELOAD
* succeeded
*/
@ -249,114 +236,22 @@ Index: multipath-tools-111219/libmultipath/configure.c
if (!conf->daemon) {
/* multipath client mode */
dm_switchgroup(mpp->alias, mpp->bestpg);
@@ -492,6 +495,10 @@ coalesce_paths (struct vectors * vecs, v
memset(empty_buff, 0, WWID_SIZE);
+ /* ignore refwwid if it's empty */
+ if (refwwid && !strlen(refwwid))
+ refwwid = NULL;
+
if (force_reload) {
vector_foreach_slot (pathvec, pp1, k) {
pp1->mpp = NULL;
@@ -521,6 +528,13 @@ coalesce_paths (struct vectors * vecs, v
if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE))
continue;
+ /* If find_multipaths was selected check if the path is valid */
+ if (conf->find_multipaths && !refwwid &&
+ !should_multipath(pp1, pathvec)) {
+ orphan_path(pp1);
+ continue;
+ }
+
/*
* at this point, we know we really got a new mp
*/
Index: multipath-tools-111219/libmultipath/defaults.h
Index: multipath-tools-120518/libmultipath/defaults.h
===================================================================
--- multipath-tools-111219.orig/libmultipath/defaults.h
+++ multipath-tools-111219/libmultipath/defaults.h
@@ -15,6 +15,7 @@
#define DEFAULT_USER_FRIENDLY_NAMES 0
#define DEFAULT_VERBOSITY 2
#define DEFAULT_REASSIGN_MAPS 1
+#define DEFAULT_FIND_MULTIPATHS 0
#define DEFAULT_CHECKINT 5
#define MAX_CHECKINT(a) (a << 2)
@@ -24,5 +25,6 @@
--- multipath-tools-120518.orig/libmultipath/defaults.h
+++ multipath-tools-120518/libmultipath/defaults.h
@@ -24,5 +24,6 @@
#define DEFAULT_SOCKET "/var/run/multipathd.sock"
#define DEFAULT_CONFIGFILE "/etc/multipath.conf"
#define DEFAULT_BINDINGS_FILE "/etc/multipath/bindings"
+#define DEFAULT_WWIDS_FILE "/etc/multipath/wwids"
char * set_default (char * str);
Index: multipath-tools-111219/libmultipath/dict.c
===================================================================
--- multipath-tools-111219.orig/libmultipath/dict.c
+++ multipath-tools-111219/libmultipath/dict.c
@@ -544,6 +544,27 @@ def_log_checker_err_handler(vector strve
}
static int
+def_find_multipaths_handler(vector strvec)
+{
+ char * buff;
+
+ buff = set_value(strvec);
+
+ if (!buff)
+ return 1;
+
+ if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
+ (strlen(buff) == 1 && !strcmp(buff, "0")))
+ conf->find_multipaths = 0;
+ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
+ (strlen(buff) == 1 && !strcmp(buff, "1")))
+ conf->find_multipaths = 1;
+
+ FREE(buff);
+ return 0;
+}
+
+static int
names_handler(vector strvec)
{
char * buff;
@@ -2365,6 +2386,18 @@ snprint_def_log_checker_err (char * buff
}
static int
+snprint_def_find_multipaths (char * buff, int len, void * data)
+{
+ if (conf->find_multipaths == DEFAULT_FIND_MULTIPATHS)
+ return 0;
+ if (!conf->find_multipaths)
+ return snprintf(buff, len, "no");
+
+ return snprintf(buff, len, "yes");
+}
+
+
+static int
snprint_def_user_friendly_names (char * buff, int len, void * data)
{
if (!conf->user_friendly_names)
@@ -2456,6 +2489,7 @@ init_keywords(void)
install_keyword("dev_loss_tmo", &def_dev_loss_handler, &snprint_def_dev_loss);
install_keyword("bindings_file", &bindings_file_handler, &snprint_def_bindings_file);
install_keyword("log_checker_err", &def_log_checker_err_handler, &snprint_def_log_checker_err);
+ install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths);
__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
__deprecated install_keyword("default_getuid_callout", &def_getuid_callout_handler, NULL);
Index: multipath-tools-111219/libmultipath/file.c
Index: multipath-tools-120518/libmultipath/file.c
===================================================================
--- /dev/null
+++ multipath-tools-111219/libmultipath/file.c
@@ -0,0 +1,178 @@
+++ multipath-tools-120518/libmultipath/file.c
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2005 Christophe Varoqui
+ * Copyright (c) 2005 Benjamin Marzinski, Redhat
@ -522,7 +417,9 @@ Index: multipath-tools-111219/libmultipath/file.c
+ "Cannot write header to file %s : %s", file,
+ strerror(errno));
+ /* cleanup partially written header */
+ ftruncate(fd, 0);
+ if (ftruncate(fd, 0))
+ condlog(0, "Cannot truncate header : %s",
+ strerror(errno));
+ goto fail;
+ }
+ fsync(fd);
@ -535,10 +432,10 @@ Index: multipath-tools-111219/libmultipath/file.c
+ close(fd);
+ return -1;
+}
Index: multipath-tools-111219/libmultipath/file.h
Index: multipath-tools-120518/libmultipath/file.h
===================================================================
--- /dev/null
+++ multipath-tools-111219/libmultipath/file.h
+++ multipath-tools-120518/libmultipath/file.h
@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2010 Benjamin Marzinski, Redhat
@ -551,11 +448,129 @@ Index: multipath-tools-111219/libmultipath/file.h
+int open_file(char *file, int *can_write, char *header);
+
+#endif /* _FILE_H */
Index: multipath-tools-111219/libmultipath/finder.c
Index: multipath-tools-120518/multipath/main.c
===================================================================
--- multipath-tools-120518.orig/multipath/main.c
+++ multipath-tools-120518/multipath/main.c
@@ -53,6 +53,7 @@
#include <errno.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include <wwids.h>
#include "dev_t.h"
int logsink;
@@ -82,7 +83,7 @@ usage (char * progname)
{
fprintf (stderr, VERSION_STRING);
fprintf (stderr, "Usage:\n");
- fprintf (stderr, " %s [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
+ fprintf (stderr, " %s [-c] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
fprintf (stderr, " %s -F [-v lvl]\n", progname);
fprintf (stderr, " %s -t\n", progname);
@@ -95,6 +96,7 @@ usage (char * progname)
" -ll show multipath topology (maximum info)\n" \
" -f flush a multipath device map\n" \
" -F flush all multipath device maps\n" \
+ " -c check if a device should be a path in a multipath device\n" \
" -q allow queue_if_no_path when multipathd is not running\n"\
" -d dry run, do not create or update devmaps\n" \
" -t dump internal hardware table\n" \
@@ -209,6 +211,7 @@ get_dm_mpvec (vector curmp, vector pathv
if (!conf->dry_run)
reinstate_paths(mpp);
+ remember_wwid(mpp->wwid);
}
return 0;
}
@@ -259,9 +262,13 @@ configure (void)
* if we have a blacklisted device parameter, exit early
*/
if (dev &&
- (filter_devnode(conf->blist_devnode, conf->elist_devnode, dev) > 0))
- goto out;
-
+ (filter_devnode(conf->blist_devnode,
+ conf->elist_devnode, dev) > 0)) {
+ if (conf->dry_run == 2)
+ printf("%s is not a valid multipath device path\n",
+ conf->dev);
+ goto out;
+ }
/*
* scope limiting must be translated into a wwid
* failing the translation is fatal (by policy)
@@ -277,6 +284,15 @@ configure (void)
if (filter_wwid(conf->blist_wwid, conf->elist_wwid,
refwwid) > 0)
goto out;
+ if (conf->dry_run == 2) {
+ if (check_wwids_file(refwwid, 0) == 0){
+ printf("%s is a valid multipath device path\n", conf->dev);
+ r = 0;
+ }
+ else
+ printf("%s is not a valid multipath device path\n", conf->dev);
+ goto out;
+ }
}
/*
@@ -412,7 +428,7 @@ main (int argc, char *argv[])
if (load_config(DEFAULT_CONFIGFILE))
exit(1);
- while ((arg = getopt(argc, argv, ":dhl::FfM:v:p:b:Brtq")) != EOF ) {
+ while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtq")) != EOF ) {
switch(arg) {
case 1: printf("optarg : %s\n",optarg);
break;
@@ -434,8 +450,12 @@ main (int argc, char *argv[])
case 'q':
conf->allow_queueing = 1;
break;
+ case 'c':
+ conf->dry_run = 2;
+ break;
case 'd':
- conf->dry_run = 1;
+ if (!conf->dry_run)
+ conf->dry_run = 1;
break;
case 'f':
conf->remove = FLUSH_ONE;
@@ -517,6 +537,11 @@ main (int argc, char *argv[])
}
dm_init();
+ if (conf->dry_run == 2 &&
+ (!conf->dev || conf->dev_type == DEV_DEVMAP)) {
+ condlog(0, "the -c option requires a path to check");
+ goto out;
+ }
if (conf->remove == FLUSH_ONE) {
if (conf->dev_type == DEV_DEVMAP)
r = dm_flush_map(conf->dev);
Index: multipath-tools-120518/libmultipath/Makefile
===================================================================
--- multipath-tools-120518.orig/libmultipath/Makefile
+++ multipath-tools-120518/libmultipath/Makefile
@@ -15,7 +15,7 @@ OBJS = memory.o parser.o vector.o devmap
pgpolicies.o debug.o regex.o defaults.o uevent.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
+ lock.o waiter.o file.o wwids.o
LIBDM_API_FLUSH = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_no_flush' /usr/include/libdevmapper.h)
Index: multipath-tools-120518/libmultipath/wwids.c
===================================================================
--- /dev/null
+++ multipath-tools-111219/libmultipath/finder.c
@@ -0,0 +1,165 @@
+++ multipath-tools-120518/libmultipath/wwids.c
@@ -0,0 +1,139 @@
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
@ -569,7 +584,7 @@ Index: multipath-tools-111219/libmultipath/finder.c
+#include "debug.h"
+#include "uxsock.h"
+#include "file.h"
+#include "finder.h"
+#include "wwids.h"
+#include "defaults.h"
+
+/*
@ -630,33 +645,27 @@ Index: multipath-tools-111219/libmultipath/finder.c
+ if (write_all(fd, buf, strlen(buf)) != strlen(buf)) {
+ condlog(0, "cannot write wwid to wwids file : %s",
+ strerror(errno));
+ ftruncate(fd, offset);
+ if (ftruncate(fd, offset))
+ condlog(0, "cannot truncate failed wwid write : %s",
+ strerror(errno));
+ return -1;
+ }
+ return 1;
+}
+
+static int
+int
+check_wwids_file(char *wwid, int write_wwid)
+{
+ int scan_fd, fd, can_write, found, ret;
+ int fd, can_write, found, ret;
+ FILE *f;
+ fd = open_file(DEFAULT_WWIDS_FILE, &can_write, WWIDS_FILE_HEADER);
+ if (fd < 0)
+ return -1;
+
+ scan_fd = dup(fd);
+ if (scan_fd < 0) {
+ condlog(0, "can't dup wwids file descriptor : %s",
+ strerror(errno));
+ close(fd);
+ return -1;
+ }
+ f = fdopen(scan_fd, "r");
+ f = fdopen(fd, "r");
+ if (!f) {
+ condlog(0,"can't fdopen wwids file : %s", strerror(errno));
+ close(fd);
+ close(scan_fd);
+ return -1;
+ }
+ found = lookup_wwid(f, wwid);
@ -673,41 +682,21 @@ Index: multipath-tools-111219/libmultipath/finder.c
+ ret = -1;
+ goto out;
+ }
+
+ if (fflush(f) != 0) {
+ condlog(0, "cannot fflush wwids file stream : %s",
+ strerror(errno));
+ ret = -1;
+ goto out;
+ }
+
+ ret = write_out_wwid(fd, wwid);
+out:
+ fclose(f);
+ close(scan_fd);
+ close(fd);
+ return ret;
+}
+
+int
+should_multipath(struct path *pp1, vector pathvec)
+{
+ int i;
+ struct path *pp2;
+
+ condlog(4, "checking if %s should be multipathed", pp1->dev);
+ vector_foreach_slot(pathvec, pp2, i) {
+ if (pp1->dev == pp2->dev)
+ continue;
+ if (strncmp(pp1->wwid, pp2->wwid, WWID_SIZE) == 0) {
+ condlog(3, "found multiple paths with wwid %s, "
+ "multipathing %s", pp1->wwid, pp1->dev);
+ return 1;
+ }
+ }
+ if (check_wwids_file(pp1->wwid, 0) < 0) {
+ condlog(3, "wwid %s not in wwids file, skipping %s",
+ pp1->wwid, pp1->dev);
+ return 0;
+ }
+ condlog(3, "found wwid %s in wwids file, multipathing %s", pp1->wwid,
+ pp1->dev);
+ return 1;
+}
+
+int
+remember_wwid(char *wwid)
+{
+ int ret = check_wwids_file(wwid, 1);
@ -721,17 +710,17 @@ Index: multipath-tools-111219/libmultipath/finder.c
+ condlog(4, "wwid %s already in wwids file", wwid);
+ return 0;
+}
Index: multipath-tools-111219/libmultipath/finder.h
Index: multipath-tools-120518/libmultipath/wwids.h
===================================================================
--- /dev/null
+++ multipath-tools-111219/libmultipath/finder.h
+++ multipath-tools-120518/libmultipath/wwids.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2010 Benjamin Marzinski, Redhat
+ */
+
+#ifndef _FINDER_H
+#define _FINDER_H
+#ifndef _WWIDS_H
+#define _WWIDS_H
+
+#define WWIDS_FILE_HEADER \
+"# Multipath wwids, Version : 1.0\n" \
@ -740,85 +729,20 @@ Index: multipath-tools-111219/libmultipath/finder.h
+"#\n" \
+"# Valid WWIDs:\n"
+
+int should_multipath(struct path *pp, vector pathvec);
+int remember_wwid(char *wwid);
+int check_wwids_file(char *wwid, int write_wwid);
+
+#endif /* _FINDER_H */
Index: multipath-tools-111219/multipath/main.c
+#endif /* _WWIDS_H */
Index: multipath-tools-120518/libmultipath/discovery.c
===================================================================
--- multipath-tools-111219.orig/multipath/main.c
+++ multipath-tools-111219/multipath/main.c
@@ -53,6 +53,7 @@
#include <errno.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include <finder.h>
#include "dev_t.h"
--- multipath-tools-120518.orig/libmultipath/discovery.c
+++ multipath-tools-120518/libmultipath/discovery.c
@@ -810,6 +810,8 @@ get_uid (struct path * pp)
int logsink;
@@ -209,6 +210,7 @@ get_dm_mpvec (vector curmp, vector pathv
memset(pp->wwid, 0, WWID_SIZE);
value = udev_device_get_property_value(pp->udev, pp->uid_attribute);
+ if ((!value || strlen(value) == 0) && conf->dry_run == 2)
+ value = getenv(pp->uid_attribute);
if (value && strlen(value)) {
size_t len = WWID_SIZE;
if (!conf->dry_run)
reinstate_paths(mpp);
+ remember_wwid(mpp->wwid);
}
return 0;
}
@@ -316,7 +318,7 @@ configure (void)
/*
* core logic entry point
*/
- r = coalesce_paths(&vecs, NULL, NULL, conf->force_reload);
+ r = coalesce_paths(&vecs, NULL, refwwid, conf->force_reload);
out:
if (refwwid)
Index: multipath-tools-111219/multipathd/main.c
===================================================================
--- multipath-tools-111219.orig/multipathd/main.c
+++ multipath-tools-111219/multipathd/main.c
@@ -48,6 +48,7 @@
#include <print.h>
#include <configure.h>
#include <prio.h>
+#include <finder.h>
#include <pgpolicies.h>
#include <uevent.h>
@@ -471,6 +472,11 @@ rescan:
return 1;
}
+ if (conf->find_multipaths &&
+ !should_multipath(pp, vecs->pathvec)) {
+ orphan_path(pp);
+ return 0;
+ }
condlog(4,"%s: creating new map", pp->dev);
if ((mpp = add_map_with_path(vecs, pp, 1))) {
mpp->action = ACT_CREATE;
Index: multipath-tools-111219/libmultipath/Makefile
===================================================================
--- multipath-tools-111219.orig/libmultipath/Makefile
+++ multipath-tools-111219/libmultipath/Makefile
@@ -15,7 +15,7 @@ OBJS = memory.o parser.o vector.o devmap
pgpolicies.o debug.o regex.o defaults.o uevent.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
+ lock.o waiter.o file.o finder.o
LIBDM_API_FLUSH = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_no_flush' /usr/include/libdevmapper.h)
Index: multipath-tools-111219/libmultipath/config.h
===================================================================
--- multipath-tools-111219.orig/libmultipath/config.h
+++ multipath-tools-111219/libmultipath/config.h
@@ -95,6 +95,7 @@ struct config {
unsigned int dev_loss;
int log_checker_err;
int allow_queueing;
+ int find_multipaths;
uid_t uid;
gid_t gid;
mode_t mode;

View File

@ -1,16 +1,18 @@
---
libmultipath/dict.c | 12 ++++++++++++
libmultipath/discovery.c | 6 +++---
libmultipath/print.c | 2 ++
libmultipath/structs.h | 3 ++-
libmultipath/structs.h | 4 +++-
multipath/main.c | 2 +-
multipath/multipath.conf.5 | 5 +++++
multipathd/main.c | 29 ++++++++++++++++++++++++++++-
5 files changed, 49 insertions(+), 2 deletions(-)
multipathd/main.c | 35 ++++++++++++++++++++++++++++++++++-
7 files changed, 60 insertions(+), 6 deletions(-)
Index: multipath-tools-120123/libmultipath/dict.c
Index: multipath-tools-120518/libmultipath/dict.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/dict.c
+++ multipath-tools-120123/libmultipath/dict.c
@@ -406,6 +406,8 @@ default_failback_handler(vector strvec)
--- multipath-tools-120518.orig/libmultipath/dict.c
+++ multipath-tools-120518/libmultipath/dict.c
@@ -398,6 +398,8 @@ default_failback_handler(vector strvec)
conf->pgfailback = -FAILBACK_MANUAL;
else if (strlen(buff) == 9 && !strcmp(buff, "immediate"))
conf->pgfailback = -FAILBACK_IMMEDIATE;
@ -19,7 +21,7 @@ Index: multipath-tools-120123/libmultipath/dict.c
else
conf->pgfailback = atoi(buff);
@@ -1031,6 +1033,8 @@ hw_failback_handler(vector strvec)
@@ -1053,6 +1055,8 @@ hw_failback_handler(vector strvec)
hwe->pgfailback = -FAILBACK_MANUAL;
else if (strlen(buff) == 9 && !strcmp(buff, "immediate"))
hwe->pgfailback = -FAILBACK_IMMEDIATE;
@ -28,7 +30,7 @@ Index: multipath-tools-120123/libmultipath/dict.c
else
hwe->pgfailback = atoi(buff);
@@ -1303,6 +1307,8 @@ mp_failback_handler(vector strvec)
@@ -1351,6 +1355,8 @@ mp_failback_handler(vector strvec)
mpe->pgfailback = -FAILBACK_MANUAL;
else if (strlen(buff) == 9 && !strcmp(buff, "immediate"))
mpe->pgfailback = -FAILBACK_IMMEDIATE;
@ -37,7 +39,7 @@ Index: multipath-tools-120123/libmultipath/dict.c
else
mpe->pgfailback = atoi(buff);
@@ -1646,6 +1652,8 @@ snprint_mp_failback (char * buff, int le
@@ -1769,6 +1775,8 @@ snprint_mp_failback (char * buff, int le
return snprintf(buff, len, "manual");
case -FAILBACK_IMMEDIATE:
return snprintf(buff, len, "immediate");
@ -46,7 +48,7 @@ Index: multipath-tools-120123/libmultipath/dict.c
default:
return snprintf(buff, len, "%i", mpe->pgfailback);
}
@@ -1985,6 +1993,8 @@ snprint_hw_failback (char * buff, int le
@@ -2130,6 +2138,8 @@ snprint_hw_failback (char * buff, int le
return snprintf(buff, len, "manual");
case -FAILBACK_IMMEDIATE:
return snprintf(buff, len, "immediate");
@ -55,7 +57,7 @@ Index: multipath-tools-120123/libmultipath/dict.c
default:
return snprintf(buff, len, "%i", hwe->pgfailback);
}
@@ -2243,6 +2253,8 @@ snprint_def_failback (char * buff, int l
@@ -2394,6 +2404,8 @@ snprint_def_failback (char * buff, int l
return snprintf(buff, len, "manual");
case -FAILBACK_IMMEDIATE:
return snprintf(buff, len, "immediate");
@ -64,10 +66,10 @@ Index: multipath-tools-120123/libmultipath/dict.c
default:
return snprintf(buff, len, "%i", conf->pgfailback);
}
Index: multipath-tools-120123/libmultipath/print.c
Index: multipath-tools-120518/libmultipath/print.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/print.c
+++ multipath-tools-120123/libmultipath/print.c
--- multipath-tools-120518.orig/libmultipath/print.c
+++ multipath-tools-120518/libmultipath/print.c
@@ -143,6 +143,8 @@ snprint_failback (char * buff, size_t le
{
if (mpp->pgfailback == -FAILBACK_IMMEDIATE)
@ -77,10 +79,10 @@ Index: multipath-tools-120123/libmultipath/print.c
if (!mpp->failback_tick)
return snprintf(buff, len, "-");
Index: multipath-tools-120123/libmultipath/structs.h
Index: multipath-tools-120518/libmultipath/structs.h
===================================================================
--- multipath-tools-120123.orig/libmultipath/structs.h
+++ multipath-tools-120123/libmultipath/structs.h
--- multipath-tools-120518.orig/libmultipath/structs.h
+++ multipath-tools-120518/libmultipath/structs.h
@@ -39,7 +39,8 @@ enum rr_weight_mode {
enum failback_mode {
FAILBACK_UNDEF,
@ -91,11 +93,19 @@ Index: multipath-tools-120123/libmultipath/structs.h
};
enum sysfs_buses {
Index: multipath-tools-120123/multipathd/main.c
@@ -151,6 +152,7 @@ struct path {
int offline;
int state;
int dmstate;
+ int chkrstate;
int failcount;
int priority;
int pgindex;
Index: multipath-tools-120518/multipathd/main.c
===================================================================
--- multipath-tools-120123.orig/multipathd/main.c
+++ multipath-tools-120123/multipathd/main.c
@@ -1011,6 +1011,32 @@ mpvec_garbage_collector (struct vectors
--- multipath-tools-120518.orig/multipathd/main.c
+++ multipath-tools-120518/multipathd/main.c
@@ -995,6 +995,32 @@ mpvec_garbage_collector (struct vectors
}
}
@ -119,7 +129,7 @@ Index: multipath-tools-120123/multipathd/main.c
+ vector_foreach_slot(pgp->paths, pp1, i) {
+ if (pp1 == pp)
+ continue;
+ if (pp1->state != PATH_DOWN && pp1->state != PATH_SHAKY)
+ if (pp1->chkrstate != PATH_DOWN && pp1->chkrstate != PATH_SHAKY)
+ return 0;
+ }
+ return 1;
@ -128,21 +138,48 @@ Index: multipath-tools-120123/multipathd/main.c
static void
defered_failback_tick (vector mpvec)
{
@@ -1238,7 +1264,8 @@ check_path (struct vectors * vecs, struc
@@ -1092,6 +1118,8 @@ check_path (struct vectors * vecs, struc
{
int newstate;
int new_path_up = 0;
+ int chkr_new_path_up = 0;
+ int oldchkrstate = pp->chkrstate;
if (!pp->mpp)
return;
@@ -1130,6 +1158,7 @@ check_path (struct vectors * vecs, struc
pp->dev);
pp->dmstate = PSTATE_UNDEF;
}
+ pp->chkrstate = newstate;
if (newstate != pp->state) {
int oldstate = pp->state;
pp->state = newstate;
@@ -1182,6 +1211,9 @@ check_path (struct vectors * vecs, struc
new_path_up = 1;
+ if (oldchkrstate != PATH_UP && oldchkrstate != PATH_GHOST)
+ chkr_new_path_up = 1;
+
/*
* if at least one path is up in a group, and
* the group is disabled, re-enable it
@@ -1233,7 +1265,8 @@ check_path (struct vectors * vecs, struc
(new_path_up || pp->mpp->failback_tick <= 0))
pp->mpp->failback_tick =
pp->mpp->pgfailback + 1;
- else if (pp->mpp->pgfailback == -FAILBACK_IMMEDIATE)
+ else if (pp->mpp->pgfailback == -FAILBACK_IMMEDIATE ||
+ followover_should_failback(pp))
+ (chkr_new_path_up && followover_should_failback(pp)))
switch_pathgroup(pp->mpp);
}
}
Index: multipath-tools-120123/multipath/multipath.conf.5
Index: multipath-tools-120518/multipath/multipath.conf.5
===================================================================
--- multipath-tools-120123.orig/multipath/multipath.conf.5
+++ multipath-tools-120123/multipath/multipath.conf.5
@@ -258,6 +258,11 @@ active paths.
--- multipath-tools-120518.orig/multipath/multipath.conf.5
+++ multipath-tools-120518/multipath/multipath.conf.5
@@ -254,6 +254,11 @@ active paths.
.B manual
Do not perform automatic failback.
.TP
@ -154,3 +191,45 @@ Index: multipath-tools-120123/multipath/multipath.conf.5
.B values > 0
deferred failback (time to defer in seconds)
.TP
Index: multipath-tools-120518/libmultipath/discovery.c
===================================================================
--- multipath-tools-120518.orig/libmultipath/discovery.c
+++ multipath-tools-120518/libmultipath/discovery.c
@@ -878,13 +878,13 @@ pathinfo (struct path *pp, vector hwtabl
if (mask & DI_CHECKER) {
if (path_state == PATH_UP) {
- pp->state = get_state(pp, 0);
+ pp->chkrstate = pp->state = get_state(pp, 0);
if (pp->state == PATH_UNCHECKED ||
pp->state == PATH_WILD)
goto blank;
} else {
condlog(3, "%s: path inaccessible", pp->dev);
- pp->state = path_state;
+ pp->chkrstate = pp->state = path_state;
}
}
@@ -912,7 +912,7 @@ blank:
* Recoverable error, for example faulty or offline path
*/
memset(pp->wwid, 0, WWID_SIZE);
- pp->state = PATH_DOWN;
+ pp->chkrstate = pp->state = PATH_DOWN;
return 0;
}
Index: multipath-tools-120518/multipath/main.c
===================================================================
--- multipath-tools-120518.orig/multipath/main.c
+++ multipath-tools-120518/multipath/main.c
@@ -144,7 +144,7 @@ update_paths (struct multipath * mpp)
/*
* path is not in sysfs anymore
*/
- pp->state = PATH_DOWN;
+ pp->chkrstate = pp->state = PATH_DOWN;
continue;
}
pp->mpp = mpp;

View File

@ -0,0 +1,34 @@
---
multipath/main.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
Index: multipath-tools-120518/multipath/main.c
===================================================================
--- multipath-tools-120518.orig/multipath/main.c
+++ multipath-tools-120518/multipath/main.c
@@ -409,6 +409,16 @@ get_dev_type(char *dev) {
return DEV_DEVMAP;
}
+static void
+convert_dev(char *dev)
+{
+ char *ptr = strstr(dev, "cciss/");
+ if (ptr) {
+ ptr += 5;
+ *ptr = '!';
+ }
+}
+
int
main (int argc, char *argv[])
{
@@ -514,6 +524,8 @@ main (int argc, char *argv[])
strncpy(conf->dev, argv[optind], FILE_NAME_SIZE);
conf->dev_type = get_dev_type(conf->dev);
+ if (conf->dev_type == DEV_DEVNODE)
+ convert_dev(conf->dev);
}
conf->daemon = 0;

View File

@ -1,76 +0,0 @@
---
multipathd/multipathd.init.redhat | 27 ++++++---------------------
1 file changed, 6 insertions(+), 21 deletions(-)
Index: multipath-tools-111219/multipathd/multipathd.init.redhat
===================================================================
--- multipath-tools-111219.orig/multipathd/multipathd.init.redhat
+++ multipath-tools-111219/multipathd/multipathd.init.redhat
@@ -73,14 +73,6 @@ start() {
echo
}
-force_stop() {
- echo -n $"Stopping $prog daemon: "
- killproc $DAEMON
- RETVAL=$?
- [ $RETVAL -eq 0 ] && rm -f $lockdir/$prog
- echo
-}
-
stop() {
root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/mtab)
dm_num=`dmsetup info -c --noheadings -o minor $root_dev 2> /dev/null`
@@ -89,7 +81,11 @@ stop() {
[ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device
fi
- force_stop
+ echo -n $"Stopping $prog daemon: "
+ killproc $DAEMON
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f $lockdir/$prog
+ echo
}
restart() {
@@ -97,11 +93,6 @@ restart() {
start
}
-force_restart() {
- force_stop
- start
-}
-
reload() {
echo -n "Reloading $prog: "
trap "" SIGHUP
@@ -117,18 +108,12 @@ start)
stop)
stop
;;
-force-stop)
- force_stop
- ;;
force-reload|reload)
reload
;;
restart)
restart
;;
-force-restart)
- force_restart
- ;;
condrestart|try-restart)
if [ -f $lockdir/$prog ]; then
restart
@@ -139,7 +124,7 @@ status)
RETVAL=$?
;;
*)
- echo $"Usage: $0 {start|stop|force-stop|status|restart|force-restart|condrestart|reload}"
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
RETVAL=2
esac

View File

@ -1,219 +0,0 @@
From a3db7def912c2fd3756cfd99c1165db075281caa Mon Sep 17 00:00:00 2001
From: Fabio M. Di Nitto <fdinitto@redhat.com>
Date: Tue, 13 Oct 2009 09:26:02 +0200
Subject: [PATCH 05/12] RH: cciss_id
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
:100644 100644 54be0a5... 7e4b7b1... M Makefile
:000000 100644 0000000... 6db12a4... A cciss_id/Makefile
:000000 100644 0000000... 091b5fe... A cciss_id/cciss_id.c
Makefile | 3 +-
cciss_id/Makefile | 47 +++++++++++++++++++
cciss_id/cciss_id.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 177 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 54be0a5..7e4b7b1 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,8 @@ BUILDDIRS = \
libmultipath/checkers \
multipath \
multipathd \
- kpartx
+ kpartx \
+ cciss_id
ifeq ($(MULTIPATH_VERSION),)
VERSION = $(shell basename ${PWD} | cut -d'-' -f3)
diff --git a/cciss_id/Makefile b/cciss_id/Makefile
new file mode 100644
index 0000000..6db12a4
--- /dev/null
+++ b/cciss_id/Makefile
@@ -0,0 +1,47 @@
+
+# *****************************************************************************
+# * *
+# * (C) Copyright 2007 Hewlett-Packard Development Company, L.P *
+# * *
+# * This program is free software; you can redistribute it and/or modify it *
+# * under the terms of the GNU General Public License as published by the Free*
+# * Software Foundation; either version 2 of the License, or (at your option)*
+# * any later version. *
+# * *
+# * This program is distributed in the hope that it will be useful, but *
+# * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY*
+# * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
+# * for more details. *
+# * *
+# * You should have received a copy of the GNU General Public License along *
+# * with this program; if not, write to the Free Software Foundation, Inc., *
+# * 675 Mass Ave, Cambridge, MA 02139, USA. *
+# * *
+# * *
+# * *
+# * *
+# *****************************************************************************
+
+include ../Makefile.inc
+
+OBJS = cciss_id.o
+CFLAGS = -pipe -g -Wall -Wunused -Wstrict-prototypes
+
+LDFLAGS = -ldevmapper
+
+EXEC = cciss_id
+
+all: $(EXEC)
+
+$(EXEC): $(OBJS)
+ $(CC) $(OBJS) -o $(EXEC) $(LDFLAGS)
+
+install:
+ $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
+ $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
+
+uninstall:
+ rm $(DESTDIR)$(bindir)/$(EXEC)
+
+clean:
+ rm -f core.* *.o $(EXEC) *.gz
diff --git a/cciss_id/cciss_id.c b/cciss_id/cciss_id.c
new file mode 100644
index 0000000..091b5fe
--- /dev/null
+++ b/cciss_id/cciss_id.c
@@ -0,0 +1,128 @@
+/*
+ *****************************************************************************
+ * *
+ * (C) Copyright 2007 Hewlett-Packard Development Company, L.P *
+ * *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the Free*
+ * Software Foundation; either version 2 of the License, or (at your option)*
+ * any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY*
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
+ * for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 675 Mass Ave, Cambridge, MA 02139, USA. *
+ * *
+ * *
+ * *
+ * *
+ *****************************************************************************
+*/
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+
+#include <linux/cciss_ioctl.h>
+
+#define LEN_PAGE83_CCISSDEV 0x20 /* Page length of 83h for cciss devices */
+#define LEN_DEVICEFILE 255 /* Length of device file name */
+#define PATH_CCISSDEV "/dev/cciss/" /* Path of CCISS devices */
+int main(int argc, char *argv[])
+{
+ const int resp_len = LEN_PAGE83_CCISSDEV;
+ unsigned char resp[resp_len+1];
+ char dev_name[LEN_DEVICEFILE] = "\0" ;
+ unsigned int lun_id = 0;
+ int fd, status, i;
+ struct stat file_stat;
+
+ LogvolInfo_struct lvi; // logical "volume" info
+ IOCTL_Command_struct cic; // cciss ioctl command
+
+ if(argc < 2) {
+ fprintf(stderr, "Usage: %s /dev/cciss/cNdN\n", argv[0]);
+ return -1;
+ }
+
+ if ( strncmp(PATH_CCISSDEV, argv[1], strlen(PATH_CCISSDEV) ) != 0 ) {
+ if ( strchr(argv[1], '!') ) {
+ sprintf(dev_name, "%s%s", PATH_CCISSDEV,
+ strchr(argv[1], '!')+1);
+ }
+ //fprintf(stderr, "dev_name is: -%s-", dev_name);
+ } else {
+ sprintf(dev_name, "%s", argv[1]);
+ }
+
+ if (stat(dev_name, &file_stat) < 0) {
+ fprintf (stderr, "Stat failed for file %s. Errno=%d\n", dev_name, errno);
+ return -1;
+ }
+ if (!S_ISBLK(file_stat.st_mode)) {
+ fprintf (stderr, "File %s is not a block device. \n", dev_name);
+ return -1;
+ }
+
+
+ if((fd = open(dev_name, O_RDWR)) < 0) {
+ fprintf(stderr, "Open failed for file %s. Errno=%d\n", dev_name, errno);
+ return -1;
+ }
+
+ if (ioctl(fd, CCISS_GETLUNINFO, &lvi) < 0) {
+ fprintf(stderr, "IOCTL failure CCISS_GETLUNINFO for file %s Errno=%d\n", dev_name, errno);
+ close(fd);
+ return -1;
+ } else {
+ lun_id = lvi.LunID;
+ }
+
+ memset(&cic, 0, sizeof(IOCTL_Command_struct));
+ memset(resp, 0, resp_len+1);
+ cic.LUN_info.LogDev.Mode = 0x01; /* logical volume addressing */
+ cic.LUN_info.LogDev.VolId = lun_id & 0x3FFFFFFF;
+ cic.Request.CDBLen = 6;
+ cic.Request.Type.Type = TYPE_CMD; // It is a command.
+ cic.Request.Type.Attribute = ATTR_SIMPLE;
+ cic.Request.Type.Direction = XFER_READ; // Read
+ cic.Request.Timeout = 0; // Don't time out
+ cic.Request.CDB[0] = 0x12;
+ cic.Request.CDB[1] = 0x01; /* EVPD (enable vital product data) */
+ cic.Request.CDB[2] = 0x83;
+ cic.Request.CDB[4] = resp_len & 0xFF;
+ cic.buf_size = resp_len;
+ cic.buf = resp;
+ status = ioctl(fd, CCISS_PASSTHRU, &cic);
+ if(status) {
+ fprintf(stderr, "IOCTL failure CCISS_PASSTHRU for file %s Errno=%d\n", dev_name, errno);
+ close(fd);
+ return -1;
+ }
+ else {
+ if ((cic.error_info.CommandStatus | cic.error_info.ScsiStatus )) {
+ fprintf(stderr, "CCISS command status error for Inquiry on %s\n",
+ dev_name);
+ close(fd);
+ return -1;
+ }
+ printf("3");
+ for(i=8; i<24; i++)
+ /* printf("Buff[%d] =%x\n", i, resp[i]); */
+ printf("%02x", resp[i]);
+ printf("\n");
+ }
+
+ close(fd);
+ return 0;
+}
--
1.6.5.1

View File

@ -1,13 +1,13 @@
---
multipath/Makefile | 6 +++---
multipath/multipath.rules | 29 +++++++++++++++++++++++------
2 files changed, 26 insertions(+), 9 deletions(-)
multipath/multipath.rules | 30 ++++++++++++++++++++++++------
2 files changed, 27 insertions(+), 9 deletions(-)
Index: multipath-tools-111219/multipath/multipath.rules
Index: multipath-tools-120613/multipath/multipath.rules
===================================================================
--- multipath-tools-111219.orig/multipath/multipath.rules
+++ multipath-tools-111219/multipath/multipath.rules
@@ -1,7 +1,24 @@
--- multipath-tools-120613.orig/multipath/multipath.rules
+++ multipath-tools-120613/multipath/multipath.rules
@@ -1,7 +1,25 @@
-#
-# udev rules for multipathing.
-# The persistent symlinks are created with the kpartx rules
@ -23,6 +23,7 @@ Index: multipath-tools-111219/multipath/multipath.rules
+
+ACTION=="add", ENV{DEVTYPE}!="partition", \
+ ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \
+ TEST=="/etc/multipath.conf", \
+ PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \
+ ENV{DM_MULTIPATH_DEVICE_PATH}="1"
+
@ -38,10 +39,10 @@ Index: multipath-tools-111219/multipath/multipath.rules
+ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath"
+RUN+="$env{MPATH_SBIN_PATH}/kpartx -a -p p $tempnode"
+LABEL="end_mpath"
Index: multipath-tools-111219/multipath/Makefile
Index: multipath-tools-120613/multipath/Makefile
===================================================================
--- multipath-tools-111219.orig/multipath/Makefile
+++ multipath-tools-111219/multipath/Makefile
--- multipath-tools-120613.orig/multipath/Makefile
+++ multipath-tools-120613/multipath/Makefile
@@ -21,15 +21,15 @@ $(EXEC): $(OBJS)
install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
@ -49,7 +50,7 @@ Index: multipath-tools-111219/multipath/Makefile
- $(INSTALL_PROGRAM) -d $(DESTDIR)/etc/udev/rules.d
- $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/etc/udev/rules.d/
+ $(INSTALL_PROGRAM) -d $(DESTDIR)/lib/udev/rules.d
+ $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/40-multipath.rules
+ $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
$(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
@ -57,7 +58,7 @@ Index: multipath-tools-111219/multipath/Makefile
uninstall:
- rm $(DESTDIR)/etc/udev/rules.d/multipath.rules
+ rm $(DESTDIR)/lib/udev/rules.d/40-multipath.rules
+ rm $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
rm $(DESTDIR)$(bindir)/$(EXEC)
rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz

View File

@ -8,29 +8,30 @@ Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
:100644 100644 7ec25d5... 06fb625... M Makefile.inc
:100644 100644 21e4ad4... 06d79c0... M kpartx/Makefile
:100644 100644 32d9ef5... 25e1483... M multipathd/Makefile
Makefile.inc | 2 +-
kpartx/Makefile | 8 ++++----
libmultipath/Makefile | 2 ++
multipathd/Makefile | 1 +
4 files changed, 8 insertions(+), 5 deletions(-)
Makefile.inc | 2 +-
kpartx/Makefile | 8 ++++----
libmpathpersist/Makefile | 7 ++-----
libmultipath/Makefile | 2 ++
multipathd/Makefile | 1 +
5 files changed, 10 insertions(+), 10 deletions(-)
Index: multipath-tools-120123/Makefile.inc
Index: multipath-tools-120613/Makefile.inc
===================================================================
--- multipath-tools-120123.orig/Makefile.inc
+++ multipath-tools-120123/Makefile.inc
@@ -28,7 +28,7 @@ libudevdir = ${prefix}/lib/udev
multipathdir = $(TOPDIR)/libmultipath
--- multipath-tools-120613.orig/Makefile.inc
+++ multipath-tools-120613/Makefile.inc
@@ -29,7 +29,7 @@ multipathdir = $(TOPDIR)/libmultipath
mandir = $(prefix)/usr/share/man/man8
man5dir = $(prefix)/usr/share/man/man5
man3dir = $(prefix)/usr/share/man/man3
-rcdir = $(prefix)/etc/init.d
+rcdir = $(prefix)/etc/rc.d/init.d
syslibdir = $(prefix)/$(LIB)
libdir = $(prefix)/$(LIB)/multipath
unitdir = $(prefix)/lib/systemd/system
Index: multipath-tools-120123/kpartx/Makefile
Index: multipath-tools-120613/kpartx/Makefile
===================================================================
--- multipath-tools-120123.orig/kpartx/Makefile
+++ multipath-tools-120123/kpartx/Makefile
--- multipath-tools-120613.orig/kpartx/Makefile
+++ multipath-tools-120613/kpartx/Makefile
@@ -26,10 +26,10 @@ $(EXEC): $(OBJS)
install: $(EXEC) $(EXEC).8
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
@ -46,10 +47,10 @@ Index: multipath-tools-120123/kpartx/Makefile
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
$(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
Index: multipath-tools-120123/multipathd/Makefile
Index: multipath-tools-120613/multipathd/Makefile
===================================================================
--- multipath-tools-120123.orig/multipathd/Makefile
+++ multipath-tools-120123/multipathd/Makefile
--- multipath-tools-120613.orig/multipathd/Makefile
+++ multipath-tools-120613/multipathd/Makefile
@@ -35,6 +35,7 @@ install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
@ -58,11 +59,11 @@ Index: multipath-tools-120123/multipathd/Makefile
$(INSTALL_PROGRAM) -d $(DESTDIR)$(unitdir)
$(INSTALL_PROGRAM) -m 644 $(EXEC).service $(DESTDIR)$(unitdir)
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
Index: multipath-tools-120123/libmultipath/Makefile
Index: multipath-tools-120613/libmultipath/Makefile
===================================================================
--- multipath-tools-120123.orig/libmultipath/Makefile
+++ multipath-tools-120123/libmultipath/Makefile
@@ -39,9 +39,11 @@ install:
--- multipath-tools-120613.orig/libmultipath/Makefile
+++ multipath-tools-120613/libmultipath/Makefile
@@ -46,9 +46,11 @@ install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir)
@ -74,3 +75,27 @@ Index: multipath-tools-120123/libmultipath/Makefile
clean:
rm -f core *.a *.o *.gz *.so *.so.*
Index: multipath-tools-120613/libmpathpersist/Makefile
===================================================================
--- multipath-tools-120613.orig/libmpathpersist/Makefile
+++ multipath-tools-120613/libmpathpersist/Makefile
@@ -28,17 +28,14 @@ $(LIBS):
install: $(LIBS)
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(man3dir)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)/usr/include/
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)/usr/share/doc/mpathpersist/
- ln -sf $(DESTDIR)$(syslibdir)/$(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ ln -sf $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
install -m 644 mpath_persistent_reserve_in.3.gz $(DESTDIR)$(man3dir)
install -m 644 mpath_persistent_reserve_out.3.gz $(DESTDIR)$(man3dir)
- install -m 644 mpath_persist.h $(DESTDIR)/usr/include/
uninstall:
rm -f $(DESTDIR)$(syslibdir)/$(LIBS)
+ rm -f $(DESTDIR)$(syslibdir)/$(DEVLIB)
rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_in.3.gz
rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_out.3.gz

View File

@ -16,11 +16,11 @@ Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
libmultipath/config.h | 1 +
2 files changed, 17 insertions(+)
Index: multipath-tools-111219/libmultipath/config.c
Index: multipath-tools-120518/libmultipath/config.c
===================================================================
--- multipath-tools-111219.orig/libmultipath/config.c
+++ multipath-tools-111219/libmultipath/config.c
@@ -20,6 +20,7 @@
--- multipath-tools-120518.orig/libmultipath/config.c
+++ multipath-tools-120518/libmultipath/config.c
@@ -21,6 +21,7 @@
#include "defaults.h"
#include "prio.h"
#include "devmapper.h"
@ -28,7 +28,7 @@ Index: multipath-tools-111219/libmultipath/config.c
static int
hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2)
@@ -539,6 +540,21 @@ load_config (char * file)
@@ -549,6 +550,21 @@ load_config (char * file)
} else {
init_keywords();
@ -50,15 +50,15 @@ Index: multipath-tools-111219/libmultipath/config.c
}
/*
Index: multipath-tools-111219/libmultipath/config.h
Index: multipath-tools-120518/libmultipath/config.h
===================================================================
--- multipath-tools-111219.orig/libmultipath/config.h
+++ multipath-tools-111219/libmultipath/config.h
--- multipath-tools-120518.orig/libmultipath/config.h
+++ multipath-tools-120518/libmultipath/config.h
@@ -6,6 +6,7 @@
#define ORIGIN_DEFAULT 0
#define ORIGIN_CONFIG 1
+#define ORIGIN_NO_CONFIG 2
enum devtypes {
DEV_NONE,
/*
* In kernel, fast_io_fail == 0 means immediate failure on rport delete.

View File

@ -2,15 +2,15 @@
libmultipath/config.c | 1
multipath/Makefile | 5
multipath/main.c | 4
multipath/mpathconf | 351 ++++++++++++++++++++++++++++++++++++++++++++++++++
multipath/mpathconf.8 | 116 ++++++++++++++++
5 files changed, 475 insertions(+), 2 deletions(-)
multipath/mpathconf | 312 ++++++++++++++++++++++++++++++++++++++++++++++++++
multipath/mpathconf.8 | 103 ++++++++++++++++
5 files changed, 423 insertions(+), 2 deletions(-)
Index: multipath-tools-111219/libmultipath/config.c
Index: multipath-tools-120613/libmultipath/config.c
===================================================================
--- multipath-tools-111219.orig/libmultipath/config.c
+++ multipath-tools-111219/libmultipath/config.c
@@ -543,6 +543,7 @@ load_config (char * file)
--- multipath-tools-120613.orig/libmultipath/config.c
+++ multipath-tools-120613/libmultipath/config.c
@@ -553,6 +553,7 @@ load_config (char * file)
condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
condlog(0, "A default multipath.conf file is located at");
condlog(0, "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", MULTIPATH_VERSION(VERSION_CODE));
@ -18,10 +18,10 @@ Index: multipath-tools-111219/libmultipath/config.c
if (conf->blist_devnode == NULL) {
conf->blist_devnode = vector_alloc();
if (!conf->blist_devnode) {
Index: multipath-tools-111219/multipath/Makefile
Index: multipath-tools-120613/multipath/Makefile
===================================================================
--- multipath-tools-111219.orig/multipath/Makefile
+++ multipath-tools-111219/multipath/Makefile
--- multipath-tools-120613.orig/multipath/Makefile
+++ multipath-tools-120613/multipath/Makefile
@@ -17,22 +17,27 @@ $(EXEC): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS)
$(GZIP) $(EXEC).8 > $(EXEC).8.gz
@ -33,7 +33,7 @@ Index: multipath-tools-111219/multipath/Makefile
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
+ $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/
$(INSTALL_PROGRAM) -d $(DESTDIR)/lib/udev/rules.d
$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/40-multipath.rules
$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
$(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
@ -41,7 +41,7 @@ Index: multipath-tools-111219/multipath/Makefile
+ $(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(mandir)
uninstall:
rm $(DESTDIR)/lib/udev/rules.d/40-multipath.rules
rm $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
rm $(DESTDIR)$(bindir)/$(EXEC)
+ rm $(DESTDIR)$(bindir)/mpathconf
rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
@ -50,11 +50,11 @@ Index: multipath-tools-111219/multipath/Makefile
clean:
rm -f core *.o $(EXEC) *.gz
Index: multipath-tools-111219/multipath/main.c
Index: multipath-tools-120613/multipath/main.c
===================================================================
--- multipath-tools-111219.orig/multipath/main.c
+++ multipath-tools-111219/multipath/main.c
@@ -406,10 +406,10 @@ main (int argc, char *argv[])
--- multipath-tools-120613.orig/multipath/main.c
+++ multipath-tools-120613/multipath/main.c
@@ -432,10 +432,10 @@ main (int argc, char *argv[])
exit(1);
}
@ -66,12 +66,12 @@ Index: multipath-tools-111219/multipath/main.c
+ if (dm_prereq())
exit(1);
if (sysfs_init(conf->sysfs_dir, FILE_NAME_SIZE)) {
Index: multipath-tools-111219/multipath/mpathconf
while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtq")) != EOF ) {
Index: multipath-tools-120613/multipath/mpathconf
===================================================================
--- /dev/null
+++ multipath-tools-111219/multipath/mpathconf
@@ -0,0 +1,351 @@
+++ multipath-tools-120613/multipath/mpathconf
@@ -0,0 +1,312 @@
+#!/bin/sh
+#
+# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
@ -91,7 +91,7 @@ Index: multipath-tools-111219/multipath/mpathconf
+# This program was largely ripped off from lvmconf
+#
+
+unset ENABLE FIND FRIENDLY MODULE MULTIPATHD CHKCONFIG HAVE_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_DEFAULTS HAVE_FRIENDLY HAVE_MULTIPATHD HAVE_CHKCONFIG HAVE_MODULE SHOW_STATUS CHANGED_CONFIG
+unset ENABLE FIND FRIENDLY MODULE MULTIPATHD HAVE_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_DEFAULTS HAVE_FRIENDLY HAVE_MULTIPATHD HAVE_MODULE SHOW_STATUS CHANGED_CONFIG
+
+DEFAULT_CONFIGFILE="/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf"
+CONFIGFILE="/etc/multipath.conf"
@ -109,7 +109,6 @@ Index: multipath-tools-111219/multipath/mpathconf
+ echo "Set find_multipaths (Default n): --find_multipaths <y|n>"
+ echo "Load the dm-multipath modules on enable (Default y): --with_module <y|n>"
+ echo "start/stop/reload multipathd (Default n): --with_multipathd <y|n>"
+ echo "chkconfig on/off multipathd (Default y): --with_chkconfig <y|n>"
+ echo ""
+}
+
@ -161,15 +160,6 @@ Index: multipath-tools-111219/multipath/mpathconf
+ exit 1
+ fi
+ ;;
+ --with_chkconfig)
+ if [ -n "$2" ]; then
+ CHKCONFIG=$2
+ shift 2
+ else
+ usage
+ exit 1
+ fi
+ ;;
+ *)
+ usage
+ exit
@ -204,10 +194,6 @@ Index: multipath-tools-111219/multipath/mpathconf
+ echo "--with_multipathd must be either 'y' or 'n'"
+ exit 1
+ fi
+ if [ -n "$CHKCONFIG" ] && [ "$CHKCONFIG" != "y" -a "$CHKCONFIG" != "n" ]; then
+ echo "--with_chkconfig must be either 'y' or 'n'"
+ exit 1
+ fi
+}
+
+umask 0077
@ -254,18 +240,6 @@ Index: multipath-tools-111219/multipath/mpathconf
+ fi
+fi
+
+if [ -z "$CHKCONFIG" -o "$CHKCONFIG" = "y" ]; then
+ chkconfig --list multipathd > /dev/null 2>&1
+ if [ $? != 0 ]; then
+ chkconfig --add multipathd
+ fi
+ if chkconfig --list multipathd | grep -q "on" ; then
+ HAVE_CHKCONFIG=1
+ else
+ HAVE_CHKCONFIG=0
+ fi
+fi
+
+if [ "$HAVE_BLACKLIST" = "1" ]; then
+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode \"\.\?\*\"" ; then
+ HAVE_DISABLE=1
@ -313,13 +287,6 @@ Index: multipath-tools-111219/multipath/mpathconf
+ if [ -n "$HAVE_MULTIPATHD" ]; then
+ service multipathd status
+ fi
+ if [ -n "$HAVE_CHKCONFIG" ]; then
+ if [ "$HAVE_CHKCONFIG" = 1 ]; then
+ echo "multipathd is chkconfiged on"
+ else
+ echo "multipathd is chkconfiged off"
+ fi
+ fi
+ exit 0
+fi
+
@ -410,24 +377,18 @@ Index: multipath-tools-111219/multipath/mpathconf
+ if [ "$HAVE_MULTIPATHD" = 0 ]; then
+ service multipathd start
+ fi
+ if [ "$HAVE_CHKCONFIG" = 0 ]; then
+ chkconfig multipathd on
+ fi
+elif [ "$ENABLE" = 0 ]; then
+ if [ "$HAVE_MULTIPATHD" = 1 ]; then
+ service multipathd stop
+ fi
+ if [ "$HAVE_CHKCONFIG" = 1 ]; then
+ chkconfig multipathd off
+ fi
+elif [ -n "$CHANGED_CONFIG" -a "$HAVE_MULTIPATHD" = 1 ]; then
+ service multipathd reload
+fi
Index: multipath-tools-111219/multipath/mpathconf.8
Index: multipath-tools-120613/multipath/mpathconf.8
===================================================================
--- /dev/null
+++ multipath-tools-111219/multipath/mpathconf.8
@@ -0,0 +1,116 @@
+++ multipath-tools-120613/multipath/mpathconf.8
@@ -0,0 +1,103 @@
+.TH MPATHCONF 8 "June 2010" "" "Linux Administrator's Manual"
+.SH NAME
+mpathconf - A tool for configuring device-mapper-multipath
@ -453,15 +414,11 @@ Index: multipath-tools-111219/multipath/mpathconf.8
+
+The default options for mpathconf are
+.B --with_module
+and
+.B --with_chkconfig.
+The
+.B --with_multipathd
+option is not set by default. Enabling multipathing will load the
+.B dm_multipath
+module and chkconfig
+.B multipathd
+to start on the next boot, but it will not immediately start it. This is so
+module but it will not immediately start it. This is so
+that users can manually edit their config file if necessary, before starting
+.B multipathd.
+
@ -525,19 +482,10 @@ Index: multipath-tools-111219/multipath/mpathconf.8
+to reconfigure multipathd on \fB--user_frindly_names\fP and
+\fB--find_multipaths\fP.
+This option is set to \fBn\fP by default.
+.TP
+.B --with_chkconfig { \fBy\fP | \fBn\fP }
+If set to \fBy\fP, this runs
+.B chkconfig multipathd on
+to set multipathd to start automatically on \fB--enable\fP and
+.B chkconfig multipathd off
+to stop multipathd for starting automatically on \fB--disable\fP.
+This option is set to \fBy\fP by default.
+.SH FILES
+.BR /etc/multipath.conf
+.SH "SEE ALSO"
+.BR multipath.conf (5),
+.BR chkconfig (8),
+.BR modprobe (8),
+.BR multipath (8),
+.BR multipathd (8),

View File

@ -0,0 +1,222 @@
---
libmultipath/config.c | 1 +
libmultipath/config.h | 1 +
libmultipath/configure.c | 11 +++++++++++
libmultipath/defaults.h | 1 +
libmultipath/dict.c | 34 ++++++++++++++++++++++++++++++++++
libmultipath/wwids.c | 26 ++++++++++++++++++++++++++
libmultipath/wwids.h | 1 +
multipath/main.c | 2 +-
multipathd/main.c | 6 ++++++
9 files changed, 82 insertions(+), 1 deletion(-)
Index: multipath-tools-120518/libmultipath/config.c
===================================================================
--- multipath-tools-120518.orig/libmultipath/config.c
+++ multipath-tools-120518/libmultipath/config.c
@@ -514,6 +514,7 @@ load_config (char * file)
conf->reassign_maps = DEFAULT_REASSIGN_MAPS;
conf->checkint = DEFAULT_CHECKINT;
conf->max_checkint = MAX_CHECKINT(conf->checkint);
+ conf->find_multipaths = DEFAULT_FIND_MULTIPATHS;
/*
* preload default hwtable
Index: multipath-tools-120518/libmultipath/configure.c
===================================================================
--- multipath-tools-120518.orig/libmultipath/configure.c
+++ multipath-tools-120518/libmultipath/configure.c
@@ -497,6 +497,10 @@ coalesce_paths (struct vectors * vecs, v
memset(empty_buff, 0, WWID_SIZE);
+ /* ignore refwwid if it's empty */
+ if (refwwid && !strlen(refwwid))
+ refwwid = NULL;
+
if (force_reload) {
vector_foreach_slot (pathvec, pp1, k) {
pp1->mpp = NULL;
@@ -526,6 +530,13 @@ coalesce_paths (struct vectors * vecs, v
if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE))
continue;
+ /* If find_multipaths was selected check if the path is valid */
+ if (conf->find_multipaths && !refwwid &&
+ !should_multipath(pp1, pathvec)) {
+ orphan_path(pp1);
+ continue;
+ }
+
/*
* at this point, we know we really got a new mp
*/
Index: multipath-tools-120518/libmultipath/defaults.h
===================================================================
--- multipath-tools-120518.orig/libmultipath/defaults.h
+++ multipath-tools-120518/libmultipath/defaults.h
@@ -15,6 +15,7 @@
#define DEFAULT_USER_FRIENDLY_NAMES 0
#define DEFAULT_VERBOSITY 2
#define DEFAULT_REASSIGN_MAPS 1
+#define DEFAULT_FIND_MULTIPATHS 0
#define DEFAULT_CHECKINT 5
#define MAX_CHECKINT(a) (a << 2)
Index: multipath-tools-120518/libmultipath/dict.c
===================================================================
--- multipath-tools-120518.orig/libmultipath/dict.c
+++ multipath-tools-120518/libmultipath/dict.c
@@ -585,6 +585,27 @@ def_reservation_key_handler(vector strve
}
static int
+def_find_multipaths_handler(vector strvec)
+{
+ char * buff;
+
+ buff = set_value(strvec);
+
+ if (!buff)
+ return 1;
+
+ if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
+ (strlen(buff) == 1 && !strcmp(buff, "0")))
+ conf->find_multipaths = 0;
+ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
+ (strlen(buff) == 1 && !strcmp(buff, "1")))
+ conf->find_multipaths = 1;
+
+ FREE(buff);
+ return 0;
+}
+
+static int
def_names_handler(vector strvec)
{
char * buff;
@@ -2549,6 +2570,18 @@ snprint_def_log_checker_err (char * buff
}
static int
+snprint_def_find_multipaths (char * buff, int len, void * data)
+{
+ if (conf->find_multipaths == DEFAULT_FIND_MULTIPATHS)
+ return 0;
+ if (!conf->find_multipaths)
+ return snprintf(buff, len, "no");
+
+ return snprintf(buff, len, "yes");
+}
+
+
+static int
snprint_def_user_friendly_names (char * buff, int len, void * data)
{
if (conf->user_friendly_names == USER_FRIENDLY_NAMES_ON)
@@ -2646,6 +2679,7 @@ init_keywords(void)
install_keyword("bindings_file", &bindings_file_handler, &snprint_def_bindings_file);
install_keyword("log_checker_err", &def_log_checker_err_handler, &snprint_def_log_checker_err);
install_keyword("reservation_key", &def_reservation_key_handler, &snprint_def_reservation_key);
+ install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths);
__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
__deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL);
Index: multipath-tools-120518/libmultipath/wwids.c
===================================================================
--- multipath-tools-120518.orig/libmultipath/wwids.c
+++ multipath-tools-120518/libmultipath/wwids.c
@@ -124,6 +124,32 @@ out:
}
int
+should_multipath(struct path *pp1, vector pathvec)
+{
+ int i;
+ struct path *pp2;
+
+ condlog(4, "checking if %s should be multipathed", pp1->dev);
+ vector_foreach_slot(pathvec, pp2, i) {
+ if (pp1->dev == pp2->dev)
+ continue;
+ if (strncmp(pp1->wwid, pp2->wwid, WWID_SIZE) == 0) {
+ condlog(3, "found multiple paths with wwid %s, "
+ "multipathing %s", pp1->wwid, pp1->dev);
+ return 1;
+ }
+ }
+ if (check_wwids_file(pp1->wwid, 0) < 0) {
+ condlog(3, "wwid %s not in wwids file, skipping %s",
+ pp1->wwid, pp1->dev);
+ return 0;
+ }
+ condlog(3, "found wwid %s in wwids file, multipathing %s", pp1->wwid,
+ pp1->dev);
+ return 1;
+}
+
+int
remember_wwid(char *wwid)
{
int ret = check_wwids_file(wwid, 1);
Index: multipath-tools-120518/libmultipath/wwids.h
===================================================================
--- multipath-tools-120518.orig/libmultipath/wwids.h
+++ multipath-tools-120518/libmultipath/wwids.h
@@ -12,6 +12,7 @@
"#\n" \
"# Valid WWIDs:\n"
+int should_multipath(struct path *pp, vector pathvec);
int remember_wwid(char *wwid);
int check_wwids_file(char *wwid, int write_wwid);
Index: multipath-tools-120518/multipath/main.c
===================================================================
--- multipath-tools-120518.orig/multipath/main.c
+++ multipath-tools-120518/multipath/main.c
@@ -332,7 +332,7 @@ configure (void)
/*
* core logic entry point
*/
- r = coalesce_paths(&vecs, NULL, NULL, conf->force_reload);
+ r = coalesce_paths(&vecs, NULL, refwwid, conf->force_reload);
out:
if (refwwid)
Index: multipath-tools-120518/multipathd/main.c
===================================================================
--- multipath-tools-120518.orig/multipathd/main.c
+++ multipath-tools-120518/multipathd/main.c
@@ -49,6 +49,7 @@
#include <print.h>
#include <configure.h>
#include <prio.h>
+#include <wwids.h>
#include <pgpolicies.h>
#include <uevent.h>
@@ -473,6 +474,11 @@ rescan:
return 1;
}
+ if (conf->find_multipaths &&
+ !should_multipath(pp, vecs->pathvec)) {
+ orphan_path(pp);
+ return 0;
+ }
condlog(4,"%s: creating new map", pp->dev);
if ((mpp = add_map_with_path(vecs, pp, 1))) {
mpp->action = ACT_CREATE;
Index: multipath-tools-120518/libmultipath/config.h
===================================================================
--- multipath-tools-120518.orig/libmultipath/config.h
+++ multipath-tools-120518/libmultipath/config.h
@@ -104,6 +104,7 @@ struct config {
unsigned int dev_loss;
int log_checker_err;
int allow_queueing;
+ int find_multipaths;
uid_t uid;
gid_t gid;
mode_t mode;

View File

@ -1,119 +0,0 @@
---
libmultipath/finder.c | 2 +-
libmultipath/finder.h | 1 +
multipath/main.c | 35 +++++++++++++++++++++++++++++------
3 files changed, 31 insertions(+), 7 deletions(-)
Index: multipath-tools-111219/libmultipath/finder.c
===================================================================
--- multipath-tools-111219.orig/libmultipath/finder.c
+++ multipath-tools-111219/libmultipath/finder.c
@@ -78,7 +78,7 @@ write_out_wwid(int fd, char *wwid) {
return 1;
}
-static int
+int
check_wwids_file(char *wwid, int write_wwid)
{
int scan_fd, fd, can_write, found, ret;
Index: multipath-tools-111219/libmultipath/finder.h
===================================================================
--- multipath-tools-111219.orig/libmultipath/finder.h
+++ multipath-tools-111219/libmultipath/finder.h
@@ -14,5 +14,6 @@
int should_multipath(struct path *pp, vector pathvec);
int remember_wwid(char *wwid);
+int check_wwids_file(char *wwid, int write_wwid);
#endif /* _FINDER_H */
Index: multipath-tools-111219/multipath/main.c
===================================================================
--- multipath-tools-111219.orig/multipath/main.c
+++ multipath-tools-111219/multipath/main.c
@@ -83,7 +83,7 @@ usage (char * progname)
{
fprintf (stderr, VERSION_STRING);
fprintf (stderr, "Usage:\n");
- fprintf (stderr, " %s [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
+ fprintf (stderr, " %s [-c] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
fprintf (stderr, " %s -F [-v lvl]\n", progname);
fprintf (stderr, " %s -t\n", progname);
@@ -96,6 +96,7 @@ usage (char * progname)
" -ll show multipath topology (maximum info)\n" \
" -f flush a multipath device map\n" \
" -F flush all multipath device maps\n" \
+ " -c check if a device should be a path in a multipath device\n" \
" -q allow queue_if_no_path when multipathd is not running\n"\
" -d dry run, do not create or update devmaps\n" \
" -t dump internal hardware table\n" \
@@ -261,9 +262,13 @@ configure (void)
* if we have a blacklisted device parameter, exit early
*/
if (dev &&
- (filter_devnode(conf->blist_devnode, conf->elist_devnode, dev) > 0))
- goto out;
-
+ (filter_devnode(conf->blist_devnode,
+ conf->elist_devnode, dev) > 0)) {
+ if (conf->dry_run == 2)
+ printf("%s is not a valid multipath device path\n",
+ conf->dev);
+ goto out;
+ }
/*
* scope limiting must be translated into a wwid
* failing the translation is fatal (by policy)
@@ -279,6 +284,15 @@ configure (void)
if (filter_wwid(conf->blist_wwid, conf->elist_wwid,
refwwid) > 0)
goto out;
+ if (conf->dry_run == 2) {
+ if (check_wwids_file(refwwid, 0) == 0){
+ printf("%s is a valid multipath device path\n", conf->dev);
+ r = 0;
+ }
+ else
+ printf("%s is not a valid multipath device path\n", conf->dev);
+ goto out;
+ }
}
/*
@@ -418,7 +432,7 @@ main (int argc, char *argv[])
condlog(0, "multipath tools need sysfs mounted");
exit(1);
}
- while ((arg = getopt(argc, argv, ":dhl::FfM:v:p:b:Brtq")) != EOF ) {
+ while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtq")) != EOF ) {
switch(arg) {
case 1: printf("optarg : %s\n",optarg);
break;
@@ -440,8 +454,12 @@ main (int argc, char *argv[])
case 'q':
conf->allow_queueing = 1;
break;
+ case 'c':
+ conf->dry_run = 2;
+ break;
case 'd':
- conf->dry_run = 1;
+ if (!conf->dry_run)
+ conf->dry_run = 1;
break;
case 'f':
conf->remove = FLUSH_ONE;
@@ -523,6 +541,11 @@ main (int argc, char *argv[])
}
dm_init();
+ if (conf->dry_run == 2 &&
+ (!conf->dev || conf->dev_type == DEV_DEVMAP)) {
+ condlog(0, "the -c option requires a path to check");
+ goto out;
+ }
if (conf->remove == FLUSH_ONE) {
if (conf->dev_type == DEV_DEVMAP)
r = dm_flush_map(conf->dev);

View File

@ -5,10 +5,10 @@
multipath.conf.annotated | 5 +
4 files changed, 128 insertions(+), 7 deletions(-)
Index: multipath-tools-111219/libmultipath/checkers.h
Index: multipath-tools-120613/libmultipath/checkers.h
===================================================================
--- multipath-tools-111219.orig/libmultipath/checkers.h
+++ multipath-tools-111219/libmultipath/checkers.h
--- multipath-tools-120613.orig/libmultipath/checkers.h
+++ multipath-tools-120613/libmultipath/checkers.h
@@ -60,6 +60,7 @@ enum path_check_state {
#define DIRECTIO "directio"
@ -33,10 +33,10 @@ Index: multipath-tools-111219/libmultipath/checkers.h
void * context; /* store for persistent data */
void ** mpcontext; /* store for persistent data shared
multipath-wide. Use MALLOC if
Index: multipath-tools-111219/libmultipath/checkers/Makefile
Index: multipath-tools-120613/libmultipath/checkers/Makefile
===================================================================
--- multipath-tools-111219.orig/libmultipath/checkers/Makefile
+++ multipath-tools-111219/libmultipath/checkers/Makefile
--- multipath-tools-120613.orig/libmultipath/checkers/Makefile
+++ multipath-tools-120613/libmultipath/checkers/Makefile
@@ -8,6 +8,7 @@ LIBS= \
libcheckcciss_tur.so \
libcheckreadsector0.so \
@ -55,10 +55,10 @@ Index: multipath-tools-111219/libmultipath/checkers/Makefile
install:
$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(libdir)
Index: multipath-tools-111219/libmultipath/checkers/tur.c
Index: multipath-tools-120613/libmultipath/checkers/tur.c
===================================================================
--- multipath-tools-111219.orig/libmultipath/checkers/tur.c
+++ multipath-tools-111219/libmultipath/checkers/tur.c
--- multipath-tools-120613.orig/libmultipath/checkers/tur.c
+++ multipath-tools-120613/libmultipath/checkers/tur.c
@@ -24,12 +24,101 @@
#define TUR_CMD_LEN 6
#define HEAVY_CHECK_COUNT 10
@ -249,10 +249,10 @@ Index: multipath-tools-111219/libmultipath/checkers/tur.c
}
pthread_attr_destroy(&attr);
tur_timeout(&tsp);
Index: multipath-tools-111219/multipath.conf.annotated
Index: multipath-tools-120613/multipath.conf.annotated
===================================================================
--- multipath-tools-111219.orig/multipath.conf.annotated
+++ multipath-tools-111219/multipath.conf.annotated
--- multipath-tools-120613.orig/multipath.conf.annotated
+++ multipath-tools-120613/multipath.conf.annotated
@@ -96,7 +96,8 @@
# # name : path_checker, checker
# # scope : multipath & multipathd
@ -265,7 +265,7 @@ Index: multipath-tools-111219/multipath.conf.annotated
# path_checker directio
@@ -493,7 +494,7 @@
# # scope : multipathd & multipathd
# # desc : path checking alorithm to use to check path state
# # desc : path checking algorithm to use to check path state
# # values : readsector0|tur|emc_clariion|hp_sw|directio|rdac|
-# # cciss_tur
+# # cciss_tur|hp_tur

View File

@ -1,141 +0,0 @@
---
libmultipath/structs_vec.c | 18 ++++++++++--------
libmultipath/structs_vec.h | 6 ++++--
libmultipath/waiter.c | 2 +-
multipathd/cli_handlers.c | 14 +++++++++++---
4 files changed, 26 insertions(+), 14 deletions(-)
Index: multipath-tools-120123/multipathd/cli_handlers.c
===================================================================
--- multipath-tools-120123.orig/multipathd/cli_handlers.c
+++ multipath-tools-120123/multipathd/cli_handlers.c
@@ -68,13 +68,16 @@ show_paths (char ** r, int * len, struct
}
int
-show_map_topology (char ** r, int * len, struct multipath * mpp)
+show_map_topology (char ** r, int * len, struct multipath * mpp,
+ struct vectors * vecs)
{
char * c;
char * reply;
unsigned int maxlen = INITIAL_REPLY_LEN;
int again = 1;
+ if (update_multipath(vecs, mpp->alias, 0))
+ return 1;
reply = MALLOC(maxlen);
while (again) {
@@ -112,9 +115,14 @@ show_maps_topology (char ** r, int * len
c = reply;
- vector_foreach_slot(vecs->mpvec, mpp, i)
+ vector_foreach_slot(vecs->mpvec, mpp, i) {
+ if (update_multipath(vecs, mpp->alias, 0)) {
+ i--;
+ continue;
+ }
c += snprint_multipath_topology(c, reply + maxlen - c,
mpp, 2);
+ }
again = ((c - reply) == (maxlen - 1));
@@ -232,7 +240,7 @@ cli_list_map_topology (void * v, char **
condlog(3, "list multipath %s (operator)", param);
- return show_map_topology(reply, len, mpp);
+ return show_map_topology(reply, len, mpp, vecs);
}
int
Index: multipath-tools-120123/libmultipath/structs_vec.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/structs_vec.c
+++ multipath-tools-120123/libmultipath/structs_vec.c
@@ -324,7 +324,7 @@ set_no_path_retry(struct multipath *mpp)
}
extern int
-setup_multipath (struct vectors * vecs, struct multipath * mpp)
+__setup_multipath (struct vectors * vecs, struct multipath * mpp, int reset)
{
if (dm_get_info(mpp->alias, &mpp->dmi)) {
/* Error accessing table */
@@ -353,11 +353,13 @@ setup_multipath (struct vectors * vecs,
condlog(3, "%s: no hardware entry found, using defaults",
mpp->alias);
}
- select_rr_weight(mpp);
- select_pgfailback(mpp);
- set_no_path_retry(mpp);
- select_pg_timeout(mpp);
- select_flush_on_last_del(mpp);
+ if (reset) {
+ select_rr_weight(mpp);
+ select_pgfailback(mpp);
+ set_no_path_retry(mpp);
+ select_pg_timeout(mpp);
+ select_flush_on_last_del(mpp);
+ }
return 0;
out:
@@ -479,7 +481,7 @@ verify_paths(struct multipath * mpp, str
return count;
}
-int update_multipath (struct vectors *vecs, char *mapname)
+int update_multipath (struct vectors *vecs, char *mapname, int reset)
{
struct multipath *mpp;
struct pathgroup *pgp;
@@ -496,7 +498,7 @@ int update_multipath (struct vectors *ve
free_pgvec(mpp->pg, KEEP_PATHS);
mpp->pg = NULL;
- if (setup_multipath(vecs, mpp))
+ if (__setup_multipath(vecs, mpp, reset))
return 1; /* mpp freed in setup_multipath */
adopt_paths(vecs->pathvec, mpp, 0);
Index: multipath-tools-120123/libmultipath/structs_vec.h
===================================================================
--- multipath-tools-120123.orig/libmultipath/structs_vec.h
+++ multipath-tools-120123/libmultipath/structs_vec.h
@@ -21,7 +21,9 @@ void orphan_path (struct path * pp);
int verify_paths(struct multipath * mpp, struct vectors * vecs, vector rpvec);
int update_mpp_paths(struct multipath * mpp, vector pathvec);
-int setup_multipath (struct vectors * vecs, struct multipath * mpp);
+int __setup_multipath (struct vectors * vecs, struct multipath * mpp,
+ int reset);
+#define setup_multipath(vecs, mpp) __setup_multipath(vecs, mpp, 1)
int update_multipath_strings (struct multipath *mpp, vector pathvec);
void remove_map (struct multipath * mpp, struct vectors * vecs, int purge_vec);
@@ -32,7 +34,7 @@ void remove_maps_and_stop_waiters (struc
struct multipath * add_map_without_path (struct vectors * vecs, char * alias);
struct multipath * add_map_with_path (struct vectors * vecs,
struct path * pp, int add_vec);
-int update_multipath (struct vectors *vecs, char *mapname);
+int update_multipath (struct vectors *vecs, char *mapname, int reset);
void update_queue_mode_del_path(struct multipath *mpp);
void update_queue_mode_add_path(struct multipath *mpp);
Index: multipath-tools-120123/libmultipath/waiter.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/waiter.c
+++ multipath-tools-120123/libmultipath/waiter.c
@@ -157,7 +157,7 @@ int waiteventloop (struct event_thread *
*/
pthread_cleanup_push(cleanup_lock, &waiter->vecs->lock);
lock(waiter->vecs->lock);
- r = update_multipath(waiter->vecs, waiter->mapname);
+ r = update_multipath(waiter->vecs, waiter->mapname, 1);
lock_cleanup_pop(waiter->vecs->lock);
if (r) {

View File

@ -2,11 +2,11 @@
multipathd/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: multipath-tools-120123/multipathd/main.c
Index: multipath-tools-120518/multipathd/main.c
===================================================================
--- multipath-tools-120123.orig/multipathd/main.c
+++ multipath-tools-120123/multipathd/main.c
@@ -1003,7 +1003,8 @@ mpvec_garbage_collector (struct vectors
--- multipath-tools-120518.orig/multipathd/main.c
+++ multipath-tools-120518/multipathd/main.c
@@ -993,7 +993,8 @@ mpvec_garbage_collector (struct vectors
return;
vector_foreach_slot (vecs->mpvec, mpp, i) {

View File

@ -1,169 +0,0 @@
---
multipath/multipath.conf.5 | 79 ++++++++++++++++++++++++++++++++++++---------
1 file changed, 64 insertions(+), 15 deletions(-)
Index: multipath-tools-120123/multipath/multipath.conf.5
===================================================================
--- multipath-tools-120123.orig/multipath/multipath.conf.5
+++ multipath-tools-120123/multipath/multipath.conf.5
@@ -82,6 +82,11 @@ maximal interval between two path checks
directory where udev creates its device nodes; default is
.I /dev
.TP
+.B multipath_dir
+directory where the dynamic shared objects are stored; default is system
+dependent, commonly
+.I /lib/multipath
+.TP
.B verbosity
default verbosity. Higher values increase the verbosity level. Valid
levels are between 0 and 6; default is
@@ -141,7 +146,7 @@ Default value is \fImultibus\fR.
The default program and args to callout to obtain a unique path
identifier. Should be specified with an absolute path. Default value
is
-.I /lib/udev/scsi_id --whitelisted --device=/dev/%n
+.I /lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/%n
.TP
.B prio
The name of the path priority routine. The specified routine
@@ -177,17 +182,22 @@ Generate the path priority for Hitachi H
.B random
Generate a random priority between 1 and 10.
.TP 12
-.B weightedpath <hbtl|devname> <regex1> <prio1> <regex2> <prio2> ...
-.I hbtl
-regex can be of SCSI H:B:T:L format Ex: 1:0:.:. , *:0:0:.
-.I devname
-regex can be of device name format Ex: sda , sd.e
+.B weightedpath
Generate the path priority based on the regular expression and the
-priority provided as argument.
+priority provided as argument. requires prio_args keyword.
.TP
Default value is \fBnone\fR.
.RE
.TP
+.B prio_args
+Arguments to pass to to the prio function. Currently only used with
+.I weighted, which needs a value of the form
+.I "<hbtl|devname> <regex1> <prio1> <regex2> <prio2> ..."
+.I hbtl
+regex can be of SCSI H:B:T:L format Ex: 1:0:.:. , *:0:0:.
+.I devname
+regex can be of device name format Ex: sda , sd.e
+.TP
.B features
Specify any device-mapper features to be used. Syntax is
.I num list
@@ -238,19 +248,33 @@ Default value is \fIdirectio\fR.
.RE
.TP
.B failback
-Tell the daemon to manage path group failback, or not to. 0 or
-.I immediate
-means immediate failback, values >0 means deferred failback (in
-seconds).
-.I manual
-means no failback. Default value is
-.I manual
+Tell multipathd how to manage path group failback.
+.RS
+.TP 12
+.B immediate
+Immediately failback to the highest priority pathgroup that contains
+active paths.
+.TP
+.B manual
+Do not perform automatic failback.
+.TP
+.B values > 0
+deferred failback (time to defer in seconds)
+.TP
+Default value is \fImanual\fR.
+.RE
.TP
.B rr_min_io
The number of IO to route to a path before switching to the next in
-the same path group. Default is
+the same path group. This is only for BIO based multipath. Default is
.I 1000
.TP
+.B rr_min_io_q
+The number of IO requests to route to a path before switching to the
+next in the same path group. This is only for request based multipath.
+Default is
+.I 1
+.TP
.B rr_weight
If set to \fIpriorities\fR the multipath configurator will assign
path weights as "path prio * rr_min_io". Possible values are
@@ -280,6 +304,13 @@ be overriden by any specific aliases in
Default is
.I no
.TP
+.B flush_on_last_del
+If set to
+.I yes
+, multipathd will disable queueing when the last path to a device has been
+deleted. Default is
+.I no
+.TP
.B max_fds
Specify the maximum number of file descriptors that can be opened by multipath
and multipathd. This is equivalent to ulimit -n. A value of \fImax\fR will set
@@ -413,12 +444,20 @@ section:
.TP
.B prio
.TP
+.B prio_args
+.TP
.B failback
.TP
+.B rr_weight
+.TP
+.B flush_on_last_del
+.TP
.B no_path_retry
.TP
.B rr_min_io
.TP
+.B rr_min_io_q
+.TP
.B features
.RE
.PD
@@ -446,6 +485,10 @@ subsection recognizes the following attr
.B product_blacklist
(Optional) Product strings to blacklist for this vendor
.TP
+.B alias_prefix
+(Optional) The user_friendly_names prefix to use for this
+device type, instead of the default "mpath"
+.TP
.B hardware_handler
(Optional) The hardware handler to use for this device type.
The following hardware handler are implemented:
@@ -483,6 +526,8 @@ section:
.TP
.B prio
.TP
+.B prio_args
+.TP
.B features
.TP
.B failback
@@ -493,9 +538,13 @@ section:
.TP
.B rr_min_io
.TP
+.B rr_min_io_rq
+.TP
.B fast_io_fail_tmo
.TP
.B dev_loss_tmo
+.TP
+.B flush_on_last_del
.RE
.PD
.LP

View File

@ -2,10 +2,10 @@
libmultipath/devmapper.c | 2 ++
1 file changed, 2 insertions(+)
Index: multipath-tools-120123/libmultipath/devmapper.c
Index: multipath-tools-120518/libmultipath/devmapper.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/devmapper.c
+++ multipath-tools-120123/libmultipath/devmapper.c
--- multipath-tools-120518.orig/libmultipath/devmapper.c
+++ multipath-tools-120518/libmultipath/devmapper.c
@@ -1272,6 +1272,8 @@ dm_rename (char * old, char * new)
goto out;
if (!dm_task_run(dmt))

View File

@ -0,0 +1,541 @@
---
libmultipath/config.c | 1
libmultipath/hwtable.c | 65 -------------------------------------------------
2 files changed, 1 insertion(+), 65 deletions(-)
Index: multipath-tools-120613/libmultipath/config.c
===================================================================
--- multipath-tools-120613.orig/libmultipath/config.c
+++ multipath-tools-120613/libmultipath/config.c
@@ -515,6 +515,7 @@ load_config (char * file)
conf->checkint = DEFAULT_CHECKINT;
conf->max_checkint = MAX_CHECKINT(conf->checkint);
conf->find_multipaths = DEFAULT_FIND_MULTIPATHS;
+ conf->fast_io_fail = 5;
/*
* preload default hwtable
Index: multipath-tools-120613/libmultipath/hwtable.c
===================================================================
--- multipath-tools-120613.orig/libmultipath/hwtable.c
+++ multipath-tools-120613/libmultipath/hwtable.c
@@ -28,7 +28,6 @@ static struct hwentry default_hw[] = {
.product = "Compellent Vol",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -50,7 +49,6 @@ static struct hwentry default_hw[] = {
.product = "Xserve RAID ",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -72,7 +70,6 @@ static struct hwentry default_hw[] = {
.product = "VV",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -88,7 +85,6 @@ static struct hwentry default_hw[] = {
.product = "HSG80",
.features = "1 queue_if_no_path",
.hwhandler = "1 hp_sw",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -104,7 +100,6 @@ static struct hwentry default_hw[] = {
.product = "A6189A",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -121,7 +116,6 @@ static struct hwentry default_hw[] = {
.product = "(MSA|HSV)1.0.*",
.features = "1 queue_if_no_path",
.hwhandler = "1 hp_sw",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -137,7 +131,6 @@ static struct hwentry default_hw[] = {
.product = "MSA VOLUME",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -153,7 +146,6 @@ static struct hwentry default_hw[] = {
.product = "HSV1[01]1|HSV2[01]0|HSV300|HSV4[05]0",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -169,7 +161,6 @@ static struct hwentry default_hw[] = {
.product = "MSA2[02]12fc|MSA2012i",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -185,7 +176,6 @@ static struct hwentry default_hw[] = {
.product = "MSA2012sa|MSA23(12|24)(fc|i|sa)|MSA2000s VOLUME",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -202,7 +192,6 @@ static struct hwentry default_hw[] = {
.product = "HSVX700",
.features = DEFAULT_FEATURES,
.hwhandler = "1 alua",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -219,7 +208,6 @@ static struct hwentry default_hw[] = {
.product = "LOGICAL VOLUME.*",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -236,7 +224,6 @@ static struct hwentry default_hw[] = {
.product = "P2000 G3 FC|P2000G3 FC/iSCSI|P2000 G3 SAS|P2000 G3 iSCSI",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -258,7 +245,6 @@ static struct hwentry default_hw[] = {
.product = "SAN DataDirector",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -280,7 +266,6 @@ static struct hwentry default_hw[] = {
.product = "SYMMETRIX",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -297,7 +282,6 @@ static struct hwentry default_hw[] = {
.bl_product = "LUNZ",
.features = "1 queue_if_no_path",
.hwhandler = "1 emc",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -314,7 +298,6 @@ static struct hwentry default_hw[] = {
.bl_product = "LUNZ",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -336,7 +319,6 @@ static struct hwentry default_hw[] = {
.product = "CentricStor",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_SERIAL,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -352,7 +334,6 @@ static struct hwentry default_hw[] = {
.product = "ETERNUS_DX(L|400|8000)",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -373,7 +354,6 @@ static struct hwentry default_hw[] = {
.product = "OPEN-.*",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -389,7 +369,6 @@ static struct hwentry default_hw[] = {
.product = "DF.*",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -411,7 +390,6 @@ static struct hwentry default_hw[] = {
.product = "ProFibre 4000R",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -429,7 +407,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = "1 queue_if_no_path",
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -447,7 +424,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = "1 queue_if_no_path",
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -465,7 +441,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = "1 queue_if_no_path",
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -483,7 +458,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = DEFAULT_FEATURES,
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -500,7 +474,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = "2 pg_init_retries 50",
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -518,7 +491,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = DEFAULT_FEATURES,
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -536,7 +508,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = DEFAULT_FEATURES,
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -554,7 +525,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = DEFAULT_FEATURES,
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -572,7 +542,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = DEFAULT_FEATURES,
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -589,7 +558,6 @@ static struct hwentry default_hw[] = {
.product = "^3542",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_SERIAL,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -606,7 +574,6 @@ static struct hwentry default_hw[] = {
.product = "^2105800",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_SERIAL,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -623,7 +590,6 @@ static struct hwentry default_hw[] = {
.product = "^2105F20",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_SERIAL,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -640,7 +606,6 @@ static struct hwentry default_hw[] = {
.product = "^1750500",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -657,7 +622,6 @@ static struct hwentry default_hw[] = {
.product = "^2107900",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -674,7 +638,6 @@ static struct hwentry default_hw[] = {
.product = "^2145",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -693,7 +656,6 @@ static struct hwentry default_hw[] = {
.uid_attribute = "ID_UID",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -712,7 +674,6 @@ static struct hwentry default_hw[] = {
.uid_attribute = "ID_UID",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -729,7 +690,6 @@ static struct hwentry default_hw[] = {
.product = "^IPR.*",
.features = "1 queue_if_no_path",
.hwhandler = "1 alua",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -746,7 +706,6 @@ static struct hwentry default_hw[] = {
.product = "1820N00",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -763,7 +722,6 @@ static struct hwentry default_hw[] = {
.product = "2810XIV",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = 15,
.rr_weight = RR_WEIGHT_NONE,
@@ -786,7 +744,6 @@ static struct hwentry default_hw[] = {
.product = "VDASD",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -803,7 +760,6 @@ static struct hwentry default_hw[] = {
.product = "3303 NVDISK",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = FAILOVER,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -820,7 +776,6 @@ static struct hwentry default_hw[] = {
.product = "NVDISK",
.features = DEFAULT_FEATURES,
.hwhandler = "1 alua",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -838,7 +793,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = "2 pg_init_retries 50",
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -856,7 +810,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = "2 pg_init_retries 50",
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -874,7 +827,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = "2 pg_init_retries 50",
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -892,7 +844,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = "2 pg_init_retries 50",
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -914,7 +865,6 @@ static struct hwentry default_hw[] = {
.product = "LUN.*",
.features = "3 queue_if_no_path pg_init_retries 50",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.flush_on_last_del = FLUSH_ENABLED,
@@ -936,7 +886,6 @@ static struct hwentry default_hw[] = {
.product = "COMSTAR",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_SERIAL,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -957,7 +906,6 @@ static struct hwentry default_hw[] = {
.product = "Nseries.*",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -978,7 +926,6 @@ static struct hwentry default_hw[] = {
.product = "Axiom.*",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -1001,7 +948,6 @@ static struct hwentry default_hw[] = {
.product = "TP9[13]00",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -1018,7 +964,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = DEFAULT_FEATURES,
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -1035,7 +980,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = "2 pg_init_retries 50",
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -1052,7 +996,6 @@ static struct hwentry default_hw[] = {
.product = "DISK ARRAY",
.features = DEFAULT_FEATURES,
.hwhandler = "1 alua",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -1075,7 +1018,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = DEFAULT_FEATURES,
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -1097,7 +1039,6 @@ static struct hwentry default_hw[] = {
.product = "(StorEdge 3510|T4)",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -1113,7 +1054,6 @@ static struct hwentry default_hw[] = {
.product = "FC2502",
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -1135,7 +1075,6 @@ static struct hwentry default_hw[] = {
.product = "RAIGE VOLUME",
.features = "1 queue_if_no_path",
.hwhandler = DEFAULT_HWHANDLER,
- .selector = DEFAULT_SELECTOR,
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
@@ -1151,7 +1090,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = DEFAULT_FEATURES,
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -1169,7 +1107,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = DEFAULT_FEATURES,
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -1187,7 +1124,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = "2 pg_init_retries 50",
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
@@ -1204,7 +1140,6 @@ static struct hwentry default_hw[] = {
.bl_product = "Universal Xport",
.features = DEFAULT_FEATURES,
.hwhandler = "1 rdac",
- .selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,

View File

@ -1,69 +0,0 @@
---
libmultipath/log_pthread.c | 1 +
libmultipath/waiter.c | 1 +
multipathd/main.c | 6 +++++-
3 files changed, 7 insertions(+), 1 deletion(-)
Index: multipath-tools-120123/multipathd/main.c
===================================================================
--- multipath-tools-120123.orig/multipathd/main.c
+++ multipath-tools-120123/multipathd/main.c
@@ -735,6 +735,7 @@ uxsock_trigger (char * str, char ** repl
pthread_cleanup_push(cleanup_lock, &vecs->lock);
lock(vecs->lock);
+ pthread_testcancel();
r = parse_cmd(str, reply, len, vecs);
@@ -787,7 +788,9 @@ uev_trigger (struct uevent * uev, void *
if (uev_discard(uev->devpath))
return 0;
+ pthread_cleanup_push(cleanup_lock, &vecs->lock);
lock(vecs->lock);
+ pthread_testcancel();
/*
* device map event
@@ -827,7 +830,7 @@ uev_trigger (struct uevent * uev, void *
}
out:
- unlock(vecs->lock);
+ lock_cleanup_pop(vecs->lock);
return r;
}
@@ -1295,6 +1298,7 @@ checkerloop (void *ap)
block_signal(SIGHUP, &old);
pthread_cleanup_push(cleanup_lock, &vecs->lock);
lock(vecs->lock);
+ pthread_testcancel();
condlog(4, "tick");
if (vecs->pathvec) {
Index: multipath-tools-120123/libmultipath/waiter.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/waiter.c
+++ multipath-tools-120123/libmultipath/waiter.c
@@ -157,6 +157,7 @@ int waiteventloop (struct event_thread *
*/
pthread_cleanup_push(cleanup_lock, &waiter->vecs->lock);
lock(waiter->vecs->lock);
+ pthread_testcancel();
r = update_multipath(waiter->vecs, waiter->mapname, 1);
lock_cleanup_pop(waiter->vecs->lock);
Index: multipath-tools-120123/libmultipath/log_pthread.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/log_pthread.c
+++ multipath-tools-120123/libmultipath/log_pthread.c
@@ -87,6 +87,7 @@ void log_thread_stop (void)
pthread_mutex_lock(logq_lock);
pthread_cancel(log_thr);
pthread_mutex_unlock(logq_lock);
+ pthread_join(log_thr, NULL);
flush_logqueue();

View File

@ -1,68 +0,0 @@
---
libmultipath/discovery.c | 22 +++++++++++++++-------
libmultipath/structs_vec.c | 5 -----
2 files changed, 15 insertions(+), 12 deletions(-)
Index: multipath-tools-120123/libmultipath/discovery.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/discovery.c
+++ multipath-tools-120123/libmultipath/discovery.c
@@ -299,17 +299,17 @@ sysfs_set_scsi_tmo (struct multipath *mp
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",
+ condlog(3, "%s: update dev_loss_tmo to %d",
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",
+ condlog(3, "%s: update dev_loss_tmo to %d",
mpp->alias, dev_loss_tmo);
}
mpp->dev_loss = dev_loss_tmo;
- if (mpp->fast_io_fail > mpp->dev_loss) {
+ if (mpp->fast_io_fail > (int)mpp->dev_loss) {
mpp->fast_io_fail = mpp->dev_loss;
- condlog(3, "%s: update fast_io_fail to %d\n",
+ condlog(3, "%s: update fast_io_fail to %d",
mpp->alias, mpp->fast_io_fail);
}
if (!mpp->dev_loss && !mpp->fast_io_fail)
@@ -333,9 +333,17 @@ sysfs_set_scsi_tmo (struct multipath *mp
snprintf(value, 11, "%u", mpp->dev_loss);
if (sysfs_attr_set_value(attr_path, "dev_loss_tmo",
value, 11) < 0) {
- condlog(0, "%s failed to set %s/dev_loss_tmo",
- mpp->alias, attr_path);
- return 1;
+ int err = 1;
+ if (mpp->fast_io_fail <= 0 && mpp->dev_loss > 600) {
+ strncpy(value, "600", 4);
+ condlog(3, "%s: limiting dev_loss_tmo to 600, since fast_io_fail is not set", mpp->alias);
+ if (sysfs_attr_set_value(attr_path, "dev_loss_tmo", value, 11) >= 0)
+ err = 0;
+ }
+ if (err) {
+ condlog(0, "%s failed to set %s/dev_loss_tmo", mpp->alias, attr_path);
+ return 1;
+ }
}
}
if (mpp->fast_io_fail){
Index: multipath-tools-120123/libmultipath/structs_vec.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/structs_vec.c
+++ multipath-tools-120123/libmultipath/structs_vec.c
@@ -441,11 +441,6 @@ verify_paths(struct multipath * mpp, str
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

View File

@ -1,17 +0,0 @@
---
multipathd/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: multipath-tools-120123/multipathd/main.c
===================================================================
--- multipath-tools-120123.orig/multipathd/main.c
+++ multipath-tools-120123/multipathd/main.c
@@ -524,7 +524,7 @@ rescan:
* update our state from kernel regardless of create or reload
*/
if (setup_multipath(vecs, mpp))
- goto fail_map;
+ goto fail; /* if setup_multipath fails, it removes the map */
sync_map_state(mpp);

View File

@ -1,24 +0,0 @@
---
kpartx/gpt.c | 9 +++++++++
1 file changed, 9 insertions(+)
Index: multipath-tools-120123/kpartx/gpt.c
===================================================================
--- multipath-tools-120123.orig/kpartx/gpt.c
+++ multipath-tools-120123/kpartx/gpt.c
@@ -367,6 +367,15 @@ is_gpt_valid(int fd, uint64_t lba,
}
+ /* Check that sizeof_partition_entry has the correct value */
+ if (__le32_to_cpu((*gpt)->sizeof_partition_entry) != sizeof(gpt_entry)) {
+ // printf("GUID partition entry size check failed.\n");
+ free(*gpt);
+ *gpt = NULL;
+ return 0;
+ }
+
+
if (!(*ptes = alloc_read_gpt_entries(fd, *gpt))) {
free(*gpt);
*gpt = NULL;

View File

@ -1,32 +0,0 @@
---
libmultipath/configure.c | 3 +++
libmultipath/discovery.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
Index: multipath-tools-120123/libmultipath/configure.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/configure.c
+++ multipath-tools-120123/libmultipath/configure.c
@@ -590,6 +590,9 @@ coalesce_paths (struct vectors * vecs, v
"for create/reload map",
mpp->alias, r);
if (r == DOMAP_FAIL) {
+ condlog(2, "%s: %s map",
+ mpp->alias, (mpp->action == ACT_CREATE)?
+ "ignoring" : "removing");
remove_map(mpp, vecs, 0);
continue;
} else /* if (r == DOMAP_RETRY) */
Index: multipath-tools-120123/libmultipath/discovery.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/discovery.c
+++ multipath-tools-120123/libmultipath/discovery.c
@@ -318,7 +318,7 @@ sysfs_set_scsi_tmo (struct multipath *mp
vector_foreach_slot(mpp->paths, pp, i) {
rport_id = find_rport_id(pp);
if (rport_id < 0) {
- condlog(0, "failed to find rport_id for target%d:%d:%d", pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.scsi_id);
+ condlog(3, "failed to find rport_id for target%d:%d:%d", pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.scsi_id);
return 1;
}

View File

@ -1,19 +0,0 @@
---
multipath/multipath.conf.5 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: multipath-tools-120123/multipath/multipath.conf.5
===================================================================
--- multipath-tools-120123.orig/multipath/multipath.conf.5
+++ multipath-tools-120123/multipath/multipath.conf.5
@@ -338,7 +338,9 @@ will disable the timeout.
.TP
.B dev_loss_tmo
Specify the number of seconds the scsi layer will wait after a problem has
-been detected on a FC remote port before removing it from the system.
+been detected on a FC remote port before removing it from the system. This
+can be set to "infinity" which sets it to the max value of 2147483647
+seconds, or 68 years.
.TP
.B queue_without_daemon
If set to

View File

@ -1,218 +0,0 @@
---
libmultipath/Makefile | 2
libmultipath/uevent.c | 151 ++++++++++++++++++++++++++++++++++++++++------
multipath/multipath.rules | 1
3 files changed, 134 insertions(+), 20 deletions(-)
Index: multipath-tools-120123/libmultipath/Makefile
===================================================================
--- multipath-tools-120123.orig/libmultipath/Makefile
+++ multipath-tools-120123/libmultipath/Makefile
@@ -7,7 +7,7 @@ include ../Makefile.inc
SONAME=0
DEVLIB = libmultipath.so
LIBS = $(DEVLIB).$(SONAME)
-LIBDEPS = -lpthread -ldl -ldevmapper
+LIBDEPS = -lpthread -ldl -ldevmapper -ludev
OBJS = memory.o parser.o vector.o devmapper.o callout.o \
hwtable.o blacklist.o util.o dmparser.o config.o \
Index: multipath-tools-120123/libmultipath/uevent.c
===================================================================
--- multipath-tools-120123.orig/libmultipath/uevent.c
+++ multipath-tools-120123/libmultipath/uevent.c
@@ -39,6 +39,7 @@
#include <pthread.h>
#include <limits.h>
#include <sys/mman.h>
+#include <libudev.h>
#include <errno.h>
#include "memory.h"
@@ -161,7 +162,7 @@ int uevent_dispatch(int (*uev_trigger)(s
return 0;
}
-int uevent_listen(void)
+int failback_listen(void)
{
int sock;
struct sockaddr_nl snl;
@@ -173,20 +174,6 @@ int uevent_listen(void)
int rcvszsz = sizeof(rcvsz);
unsigned int *prcvszsz = (unsigned int *)&rcvszsz;
const int feature_on = 1;
-
- /*
- * Queue uevents for service by dedicated thread so that the uevent
- * listening thread does not block on multipathd locks (vecs->lock)
- * thereby not getting to empty the socket's receive buffer queue
- * often enough.
- */
- INIT_LIST_HEAD(&uevq);
-
- pthread_mutex_init(uevq_lockp, NULL);
- pthread_cond_init(uev_condp, NULL);
-
- pthread_cleanup_push(uevq_stop, NULL);
-
/*
* First check whether we have a udev socket
*/
@@ -382,13 +369,141 @@ int uevent_listen(void)
exit:
close(sock);
+ return 1;
+}
- pthread_cleanup_pop(1);
+int uevent_listen(void)
+{
+ int err;
+ struct udev *udev = NULL;
+ struct udev_monitor *monitor = NULL;
+ int fd, socket_flags;
+ int need_failback = 0;
+ /*
+ * Queue uevents for service by dedicated thread so that the uevent
+ * listening thread does not block on multipathd locks (vecs->lock)
+ * thereby not getting to empty the socket's receive buffer queue
+ * often enough.
+ */
+ INIT_LIST_HEAD(&uevq);
+
+ pthread_mutex_init(uevq_lockp, NULL);
+ pthread_cond_init(uev_condp, NULL);
+ pthread_cleanup_push(uevq_stop, NULL);
+
+ udev = udev_new();
+ if (!udev) {
+ condlog(2, "failed to create udev context");
+ need_failback = 1;
+ goto out;
+ }
+ monitor = udev_monitor_new_from_netlink(udev, "udev");
+ if (!monitor) {
+ condlog(2, "failed to create udev monitor");
+ need_failback = 1;
+ goto out;
+ }
+ if (udev_monitor_set_receive_buffer_size(monitor, 128 * 1024 * 1024))
+ condlog(2, "failed to increase buffer size");
+ fd = udev_monitor_get_fd(monitor);
+ socket_flags = fcntl(fd, F_GETFL);
+ if (socket_flags < 0) {
+ condlog(2, "failed to get monitor socket flags : %s",
+ strerror(errno));
+ need_failback = 1;
+ goto out;
+ }
+ if (fcntl(fd, F_SETFL, socket_flags & ~O_NONBLOCK) < 0) {
+ condlog(2, "failed to set monitor socket flags : %s",
+ strerror(errno));
+ need_failback = 1;
+ goto out;
+ }
+ err = udev_monitor_filter_add_match_subsystem_devtype(monitor, "block",
+ NULL);
+ if (err)
+ condlog(2, "failed to create filter : %s\n", strerror(-err));
+ err = udev_monitor_enable_receiving(monitor);
+ if (err) {
+ condlog(2, "failed to enable receiving : %s\n", strerror(-err));
+ need_failback = 1;
+ goto out;
+ }
+ while (1) {
+ int i = 0;
+ char *pos, *end;
+ struct uevent *uev;
+ struct udev_device *dev;
+ struct udev_list_entry *list_entry;
+
+ dev = udev_monitor_receive_device(monitor);
+ if (!dev) {
+ condlog(0, "failed getting udev device");
+ continue;
+ }
+ uev = alloc_uevent();
+ if (!uev) {
+ condlog(1, "lost uevent, oom");
+ continue;
+ }
+ pos = uev->buffer;
+ end = pos + HOTPLUG_BUFFER_SIZE + OBJECT_SIZE - 1;
+ udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(dev)) {
+ const char *name, *value;
+ int bytes;
+
+ name = udev_list_entry_get_name(list_entry);
+ value = udev_list_entry_get_value(list_entry);
+ bytes = snprintf(pos, end - pos, "%s=%s", name,
+ value);
+ if (pos + bytes >= end) {
+ condlog(2, "buffer overflow for uevent");
+ break;
+ }
+ uev->envp[i] = pos;
+ pos += bytes;
+ *pos = '\0';
+ pos++;
+ if (strcmp(name, "DEVPATH") == 0)
+ uev->devpath = uev->envp[i] + 8;
+ if (strcmp(name, "ACTION") == 0)
+ uev->action = uev->envp[i] + 7;
+ i++;
+ if (i == HOTPLUG_NUM_ENVP - 1)
+ break;
+ }
+ udev_device_unref(dev);
+ uev->envp[i] = NULL;
+
+ condlog(3, "uevent '%s' from '%s'", uev->action, uev->devpath);
+ uev->kernel = strrchr(uev->devpath, '/');
+ if (uev->kernel)
+ uev->kernel++;
+
+ /* print payload environment */
+ for (i = 0; uev->envp[i] != NULL; i++)
+ condlog(5, "%s", uev->envp[i]);
+
+ /*
+ * Queue uevent and poke service pthread.
+ */
+ pthread_mutex_lock(uevq_lockp);
+ list_add_tail(&uev->node, &uevq);
+ pthread_cond_signal(uev_condp);
+ pthread_mutex_unlock(uevq_lockp);
+ }
+out:
+ if (monitor)
+ udev_monitor_unref(monitor);
+ if (udev)
+ udev_unref(udev);
+ if (need_failback)
+ err = failback_listen();
+ pthread_cleanup_pop(1);
pthread_mutex_destroy(uevq_lockp);
pthread_cond_destroy(uev_condp);
-
- return 1;
+ return err;
}
extern int
Index: multipath-tools-120123/multipath/multipath.rules
===================================================================
--- multipath-tools-120123.orig/multipath/multipath.rules
+++ multipath-tools-120123/multipath/multipath.rules
@@ -13,7 +13,6 @@ ACTION=="add", ENV{DEVTYPE}!="partition"
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DEVTYPE}!="partition", \
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
-RUN+="socket:/org/kernel/dm/multipath_event"
KERNEL!="dm-*", GOTO="end_mpath"
ACTION!="change", GOTO="end_mpath"
ENV{DM_UUID}=="mpath-?*|part[0-9]*-mpath-?*", OPTIONS+="link_priority=10"

View File

@ -1,44 +1,35 @@
Summary: Tools to manage multipath devices using device-mapper
Name: device-mapper-multipath
Version: 0.4.9
Release: 26%{?dist}
Release: 27%{?dist}
License: GPL+
Group: System Environment/Base
URL: http://christophe.varoqui.free.fr/
Source0: multipath-tools-120123.tgz
Source0: multipath-tools-120613.tgz
Source1: multipath.conf
Patch0001: 0001-RH-fix-async-tur.patch
Patch0002: 0002-RH-dont_start_with_no_config.patch
Patch0003: 0003-RH-multipath.rules.patch
Patch0004: 0004-RH-update-init-script.patch
Patch0005: 0005-RH-cciss_id.patch
Patch0006: 0006-RH-Make-build-system-RH-Fedora-friendly.patch
Patch0007: 0007-RH-multipathd-blacklist-all-by-default.patch
Patch0008: 0008-RH-add-mpathconf.patch
Patch0009: 0009-RH-add-find-multipaths.patch
Patch0010: 0010-RH-check-if-multipath-owns-path.patch
Patch0001: 0001-RH-remove_callout.patch
Patch0002: 0002-RH-add-wwids-file.patch
Patch0003: 0003-RH-add-followover.patch
Patch0004: 0004-RH-fix-cciss-names.patch
Patch0005: 0005-RH-dont_start_with_no_config.patch
Patch0006: 0006-RH-multipath.rules.patch
Patch0007: 0007-RH-Make-build-system-RH-Fedora-friendly.patch
Patch0008: 0008-RH-multipathd-blacklist-all-by-default.patch
Patch0009: 0009-RH-add-mpathconf.patch
Patch0010: 0010-RH-add-find-multipaths.patch
Patch0011: 0011-RH-add-hp_tur-checker.patch
Patch0012: 0012-RH-update-on-show-topology.patch
Patch0013: 0013-RH-manpage-update.patch
Patch0014: 0014-RH-RHEL5-style-partitions.patch
Patch0015: 0015-RH-add-followover.patch
Patch0016: 0016-RH-dont-remove-map-on-enomem.patch
Patch0017: 0017-RH-fix-shutdown-crash.patch
Patch0018: 0018-RH-warn-on-bad-dev-loss-tmo.patch
Patch0019: 0019-RH-deprecate-uid-gid-mode.patch
Patch0020: 0020-RH-dont-remove-map-twice.patch
Patch0021: 0021-RH-validate-guid-partitions.patch
Patch0022: 0022-RH-adjust-messages.patch
Patch0023: 0023-RH-manpage-update.patch
Patch0024: 0024-RH-libudev-monitor.patch
Patch0025: 0025-RHBZ-822714-update-nodes.patch
Patch0012: 0012-RH-RHEL5-style-partitions.patch
Patch0013: 0013-RH-dont-remove-map-on-enomem.patch
Patch0014: 0014-RH-deprecate-uid-gid-mode.patch
Patch0015: 0015-RH-use-sync-support.patch
Patch0016: 0016-RH-change-configs.patch
# runtime
Requires: %{name}-libs = %{version}-%{release}
Requires: kpartx = %{version}-%{release}
Requires: device-mapper >= 1.02.39-1
Requires: udev initscripts libudev
Requires: initscripts
Requires(post): systemd-units systemd-sysv chkconfig
Requires(preun): systemd-units
Requires(postun): systemd-units
@ -47,7 +38,7 @@ Requires(postun): systemd-units
BuildRequires: libaio-devel, device-mapper-devel >= 1.02.39-1
BuildRequires: libselinux-devel, libsepol-devel
BuildRequires: readline-devel, ncurses-devel
BuildRequires: systemd-units, libudev-devel
BuildRequires: systemd-units, systemd-devel
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
@ -84,7 +75,7 @@ Group: System Environment/Base
kpartx manages partition creation and removal for device-mapper devices.
%prep
%setup -q -n multipath-tools-120123
%setup -q -n multipath-tools-120613
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
@ -101,15 +92,6 @@ kpartx manages partition creation and removal for device-mapper devices.
%patch0014 -p1
%patch0015 -p1
%patch0016 -p1
%patch0017 -p1
%patch0018 -p1
%patch0019 -p1
%patch0020 -p1
%patch0021 -p1
%patch0022 -p1
%patch0023 -p1
%patch0024 -p1
%patch0025 -p1
cp %{SOURCE1} .
%build
@ -166,17 +148,19 @@ bin/systemctl --no-reload enable multipathd.service >/dev/null 2>&1 ||:
%defattr(-,root,root,-)
%{_sbindir}/multipath
%{_sbindir}/multipathd
%{_sbindir}/cciss_id
%{_sbindir}/mpathconf
%{_sbindir}/mpathpersist
%{_unitdir}/multipathd.service
%{_mandir}/man3/mpath_persistent_reserve_in.3.gz
%{_mandir}/man3/mpath_persistent_reserve_out.3.gz
%{_mandir}/man5/multipath.conf.5.gz
%{_mandir}/man8/multipath.8.gz
%{_mandir}/man8/multipathd.8.gz
%{_mandir}/man8/mpathconf.8.gz
%config /lib/udev/rules.d/40-multipath.rules
%{_mandir}/man8/mpathpersist.8.gz
%config /lib/udev/rules.d/62-multipath.rules
%doc AUTHOR COPYING FAQ
%doc multipath.conf multipath.conf.annotated
%doc multipath.conf.defaults multipath.conf.synthetic
%doc multipath.conf
%dir /etc/multipath
%files libs
@ -184,6 +168,8 @@ bin/systemctl --no-reload enable multipathd.service >/dev/null 2>&1 ||:
%doc AUTHOR COPYING
%{_libdir}/libmultipath.so
%{_libdir}/libmultipath.so.*
%{_libdir}/libmpathpersist.so
%{_libdir}/libmpathpersist.so.*
%dir %{_libmpathdir}
%{_libmpathdir}/*
@ -200,6 +186,22 @@ bin/systemctl --no-reload enable multipathd.service >/dev/null 2>&1 ||:
%{_mandir}/man8/kpartx.8.gz
%changelog
* Thu Jun 28 2012 Benjamin Marzinski <bmarzins@redhat.com> 0.4.9-27
- Updated to latest upstream 0.4.9 code : multipath-tools-120613.tgz
(git commit id: cb0f7127ba90ab5e8e71fc534a0a16cdbe96a88f)
- Add 0001-RH-remove_callout.patch
* multipath no longer uses the getuid callout. It now gets the
wwid from the udev database or the environment variables
- Add 0004-RH-fix-cciss-names.patch
* convert cciss device names from cciss/cXdY to sysfs style cciss!cXdY
- Split 0009-RH-add-find-multipaths.patch into 0002-RH-add-wwids-file.patch
and 0010-RH-add-find-multipaths.patch
- Add 0016-RH-change-configs.patch
* default fast_io_fail to 5 and don't set the path selector in the
builtin configs.
Resolves: bz #831978
* Mon May 18 2012 Benjamin Marzinski <bmarzins@redhat.com> 0.4.9-26
- Add 0025-RHBZ-822714-update-nodes.patch
- Resolves: bz #822714

View File

@ -1 +1 @@
7cea74ff9f3b494d1cba6884617d08fd multipath-tools-120123.tgz
84632b08dbca9fa04179edd8c469c92a multipath-tools-120613.tgz