diff --git a/.gitignore b/.gitignore index 5d64e6b..3c41636 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ multipath-tools-091027.tar.gz /multipath-tools-0.7.7.tgz /multipath-tools-ef6d98b.tgz /multipath-tools-1a8625a.tgz +/multipath-tools-b80318b.tgz diff --git a/0001-kpartx-Use-absolute-paths-to-create-mappings.patch b/0001-kpartx-Use-absolute-paths-to-create-mappings.patch new file mode 100644 index 0000000..0d65cea --- /dev/null +++ b/0001-kpartx-Use-absolute-paths-to-create-mappings.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Stef Walter +Date: Sat, 6 Oct 2018 09:38:56 +0200 +Subject: [PATCH] kpartx: Use absolute paths to create mappings + +kpartx -d now uses absolute paths to delete mappings, since the +commit 9bdfa3eb8e24b668e6c2bb882cddb0ccfe23ed5b. We should use +those same absolute paths to create the mappings. + +Without this patch, the following workflow (as seen in the +manual page for kpartx) fails to actually remove the devices: + + # kpartx -av disk.img + ... + # kpartx -d disk.img + +Signed-off-by: Benjamin Marzinski +--- + kpartx/kpartx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c +index 442b6bd..d4fb53b 100644 +--- a/kpartx/kpartx.c ++++ b/kpartx/kpartx.c +@@ -341,7 +341,7 @@ main(int argc, char **argv){ + if (!loopdev) { + loopdev = find_unused_loop_device(); + +- if (set_loop(loopdev, device, 0, &ro)) { ++ if (set_loop(loopdev, rpath, 0, &ro)) { + fprintf(stderr, "can't set up loop\n"); + exit (1); + } +-- +2.7.4 + diff --git a/0001-libmultipath-fix-tur-checker-timeout.patch b/0002-libmultipath-fix-tur-checker-timeout.patch similarity index 56% rename from 0001-libmultipath-fix-tur-checker-timeout.patch rename to 0002-libmultipath-fix-tur-checker-timeout.patch index 01c6600..e183982 100644 --- a/0001-libmultipath-fix-tur-checker-timeout.patch +++ b/0002-libmultipath-fix-tur-checker-timeout.patch @@ -5,45 +5,44 @@ Subject: [PATCH] libmultipath: fix tur checker timeout The code previously was timing out mode if ct->thread was 0 but ct->running wasn't. This combination never happens. The idea was to -timeout if for some reason the path checker tried to kill the thread, +timeout if for some reason the path checker tried to cancel the thread, but it didn't die. The correct thing to check for this is ct->holders. ct->holders will always be at least one when libcheck_check() is called, since libcheck_free() won't get called until the device is no longer being checked. So, if ct->holders is 2, that means that the tur thread is has not shut down yet. -Also, instead of returning PATH_TIMEOUT whenever the thread hasn't died, -it should only time out if the thread didn't successfully get a value, -which means the previous state was already PATH_TIMEOUT. +Also, instead of timing out, the tur checker will switch to synchronous +mode. The chance of this code path happening is very low. I simply +exists because the old thread must not interfere with a new thread +starting up. But if something does go very wrong, and a thread does get +stuck, this solution will keep the checker from just ignoring the device +forever. Signed-off-by: Benjamin Marzinski --- - libmultipath/checkers/tur.c | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) + libmultipath/checkers/tur.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c -index bf8486d..275541f 100644 +index bf8486d..3c5e236 100644 --- a/libmultipath/checkers/tur.c +++ b/libmultipath/checkers/tur.c -@@ -355,12 +355,15 @@ int libcheck_check(struct checker * c) +@@ -355,12 +355,13 @@ int libcheck_check(struct checker * c) } pthread_mutex_unlock(&ct->lock); } else { - if (uatomic_read(&ct->running) != 0) { - /* pthread cancel failed. continue in sync mode */ -- pthread_mutex_unlock(&ct->lock); -- condlog(3, "%s: tur thread not responding", -- tur_devt(devt, sizeof(devt), ct)); -- return PATH_TIMEOUT; + if (uatomic_read(&ct->holders) > 1) { -+ /* pthread cancel failed. If it didn't get the path -+ state already, timeout */ -+ if (ct->state == PATH_PENDING) { -+ pthread_mutex_unlock(&ct->lock); -+ condlog(3, "%s: tur thread not responding", -+ tur_devt(devt, sizeof(devt), ct)); -+ return PATH_TIMEOUT; -+ } ++ /* The thread has been cancelled but hasn't ++ * quilt. Fail back to synchronous mode */ + pthread_mutex_unlock(&ct->lock); +- condlog(3, "%s: tur thread not responding", ++ condlog(3, "%s: tur checker failing back to sync", + tur_devt(devt, sizeof(devt), ct)); +- return PATH_TIMEOUT; ++ return tur_check(c->fd, c->timeout, copy_msg_to_checker, c); } /* Start new TUR checker */ ct->state = PATH_UNCHECKED; diff --git a/0002-libmultipath-fix-tur-checker-double-locking.patch b/0003-libmultipath-fix-tur-checker-double-locking.patch similarity index 70% rename from 0002-libmultipath-fix-tur-checker-double-locking.patch rename to 0003-libmultipath-fix-tur-checker-double-locking.patch index 08a6398..553c586 100644 --- a/0002-libmultipath-fix-tur-checker-double-locking.patch +++ b/0003-libmultipath-fix-tur-checker-double-locking.patch @@ -7,28 +7,22 @@ tur_devt() locks ct->lock. However, it is ocassionally called while ct->lock is already locked. In reality, there is no reason why we need to lock all the accesses to ct->devt. The tur checker only needs to write to this variable one time, when it first gets the file descripter -that it is checking. It also never uses ct->devt directly. Instead, it -always graps the major and minor, and turns them into a string. This -patch changes ct->devt into that string, and sets it in libcheck_init() -when it is first initializing the checker context. After that, ct->devt -is only ever read. +that it is checking. This patch sets ct->devt in libcheck_init() when it +is first initializing the checker context. After that, ct->devt is only +ever read. -Cc: Bart Van Assche Signed-off-by: Benjamin Marzinski --- - libmultipath/checkers/tur.c | 55 +++++++++++++-------------------------------- - 1 file changed, 16 insertions(+), 39 deletions(-) + libmultipath/checkers/tur.c | 60 +++++++++++++++------------------------------ + 1 file changed, 20 insertions(+), 40 deletions(-) diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c -index 275541f..d173648 100644 +index 3c5e236..5844639 100644 --- a/libmultipath/checkers/tur.c +++ b/libmultipath/checkers/tur.c -@@ -37,36 +37,24 @@ - #define MSG_TUR_FAILED "tur checker failed to initialize" - +@@ -39,34 +39,22 @@ struct tur_checker_context { -- dev_t devt; -+ char devt[32]; + dev_t devt; int state; - int running; + int running; /* uatomic access only */ @@ -64,17 +58,16 @@ index 275541f..d173648 100644 ct = malloc(sizeof(struct tur_checker_context)); if (!ct) -@@ -81,6 +69,9 @@ int libcheck_init (struct checker * c) +@@ -81,6 +69,8 @@ int libcheck_init (struct checker * c) pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(&ct->lock, &attr); pthread_mutexattr_destroy(&attr); + if (fstat(c->fd, &sb) == 0) -+ snprintf(ct->devt, sizeof(ct->devt), "%d:%d", major(sb.st_rdev), -+ minor(sb.st_rdev)); ++ ct->devt = sb.st_rdev; c->context = ct; return 0; -@@ -232,14 +223,12 @@ static void *tur_thread(void *ctx) +@@ -232,14 +222,13 @@ static void *tur_thread(void *ctx) { struct tur_checker_context *ct = ctx; int state, running; @@ -86,7 +79,8 @@ index 275541f..d173648 100644 - condlog(3, "%s: tur checker starting up", - tur_devt(devt, sizeof(devt), ct)); -+ condlog(3, "%s: tur checker starting up", ct->devt); ++ condlog(3, "%d:%d : tur checker starting up", major(ct->devt), ++ minor(ct->devt)); /* TUR checker start up */ pthread_mutex_lock(&ct->lock); @@ -96,8 +90,8 @@ index 275541f..d173648 100644 - condlog(3, "%s: tur checker finished, state %s", - tur_devt(devt, sizeof(devt), ct), checker_state_name(state)); -+ condlog(3, "%s: tur checker finished, state %s", ct->devt, -+ checker_state_name(state)); ++ condlog(3, "%d:%d : tur checker finished, state %s", major(ct->devt), ++ minor(ct->devt), checker_state_name(state)); running = uatomic_xchg(&ct->running, 0); if (!running) @@ -132,48 +126,55 @@ index 275541f..d173648 100644 MSG(c, MSG_TUR_FAILED); return PATH_WILD; } -@@ -338,14 +318,12 @@ int libcheck_check(struct checker * c) +@@ -338,14 +318,14 @@ int libcheck_check(struct checker * c) int running = uatomic_xchg(&ct->running, 0); if (running) pthread_cancel(ct->thread); - condlog(3, "%s: tur checker timeout", - tur_devt(devt, sizeof(devt), ct)); -+ condlog(3, "%s: tur checker timeout", ct->devt); ++ condlog(3, "%d:%d : tur checker timeout", ++ major(ct->devt), minor(ct->devt)); ct->thread = 0; MSG(c, MSG_TUR_TIMEOUT); tur_status = PATH_TIMEOUT; } else if (uatomic_read(&ct->running) != 0) { - condlog(3, "%s: tur checker not finished", - tur_devt(devt, sizeof(devt), ct)); -+ condlog(3, "%s: tur checker not finished", ct->devt); ++ condlog(3, "%d:%d : tur checker not finished", ++ major(ct->devt), minor(ct->devt)); tur_status = PATH_PENDING; } else { /* TUR checker done */ -@@ -361,7 +339,7 @@ int libcheck_check(struct checker * c) - if (ct->state == PATH_PENDING) { - pthread_mutex_unlock(&ct->lock); - condlog(3, "%s: tur thread not responding", -- tur_devt(devt, sizeof(devt), ct)); -+ ct->devt); - return PATH_TIMEOUT; - } +@@ -359,8 +339,8 @@ int libcheck_check(struct checker * c) + /* The thread has been cancelled but hasn't + * quilt. Fail back to synchronous mode */ + pthread_mutex_unlock(&ct->lock); +- condlog(3, "%s: tur checker failing back to sync", +- tur_devt(devt, sizeof(devt), ct)); ++ condlog(3, "%d:%d : tur checker failing back to sync", ++ major(ct->devt), minor(ct->devt)); + return tur_check(c->fd, c->timeout, copy_msg_to_checker, c); } -@@ -381,7 +359,7 @@ int libcheck_check(struct checker * c) + /* Start new TUR checker */ +@@ -378,8 +358,8 @@ int libcheck_check(struct checker * c) + uatomic_set(&ct->running, 0); ct->thread = 0; pthread_mutex_unlock(&ct->lock); - condlog(3, "%s: failed to start tur thread, using" +- condlog(3, "%s: failed to start tur thread, using" - " sync mode", tur_devt(devt, sizeof(devt), ct)); -+ " sync mode", ct->devt); ++ condlog(3, "%d:%d : failed to start tur thread, using" ++ " sync mode", major(ct->devt), minor(ct->devt)); return tur_check(c->fd, c->timeout, copy_msg_to_checker, c); } -@@ -392,8 +370,7 @@ int libcheck_check(struct checker * c) +@@ -390,8 +370,8 @@ int libcheck_check(struct checker * c) pthread_mutex_unlock(&ct->lock); if (uatomic_read(&ct->running) != 0 && (tur_status == PATH_PENDING || tur_status == PATH_UNCHECKED)) { - condlog(3, "%s: tur checker still running", - tur_devt(devt, sizeof(devt), ct)); -+ condlog(3, "%s: tur checker still running", ct->devt); ++ condlog(3, "%d:%d : tur checker still running", ++ major(ct->devt), minor(ct->devt)); tur_status = PATH_PENDING; } else { int running = uatomic_xchg(&ct->running, 0); diff --git a/0003-libmultipath-fix-tur-memory-misuse.patch b/0004-libmultipath-fix-tur-memory-misuse.patch similarity index 83% rename from 0003-libmultipath-fix-tur-memory-misuse.patch rename to 0004-libmultipath-fix-tur-memory-misuse.patch index 8d58ee1..1c991e2 100644 --- a/0003-libmultipath-fix-tur-memory-misuse.patch +++ b/0004-libmultipath-fix-tur-memory-misuse.patch @@ -14,14 +14,14 @@ write to, and copy it later, if necessary. Signed-off-by: Benjamin Marzinski --- - libmultipath/checkers/tur.c | 46 +++++++++++---------------------------------- - 1 file changed, 11 insertions(+), 35 deletions(-) + libmultipath/checkers/tur.c | 48 ++++++++++++--------------------------------- + 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c -index d173648..abda162 100644 +index 5844639..0c7b5ca 100644 --- a/libmultipath/checkers/tur.c +++ b/libmultipath/checkers/tur.c -@@ -103,17 +103,8 @@ void libcheck_free (struct checker * c) +@@ -102,17 +102,8 @@ void libcheck_free (struct checker * c) return; } @@ -40,7 +40,7 @@ index d173648..abda162 100644 { struct sg_io_hdr io_hdr; unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; -@@ -132,7 +123,7 @@ retry: +@@ -131,7 +122,7 @@ retry: io_hdr.timeout = timeout * 1000; io_hdr.pack_id = 0; if (ioctl(fd, SG_IO, &io_hdr) < 0) { @@ -49,7 +49,7 @@ index d173648..abda162 100644 return PATH_DOWN; } if ((io_hdr.status & 0x7e) == 0x18) { -@@ -140,7 +131,7 @@ retry: +@@ -139,7 +130,7 @@ retry: * SCSI-3 arrays might return * reservation conflict on TUR */ @@ -58,7 +58,7 @@ index d173648..abda162 100644 return PATH_UP; } if (io_hdr.info & SG_INFO_OK_MASK) { -@@ -185,14 +176,14 @@ retry: +@@ -184,14 +175,14 @@ retry: * LOGICAL UNIT NOT ACCESSIBLE, * TARGET PORT IN STANDBY STATE */ @@ -76,7 +76,7 @@ index d173648..abda162 100644 return PATH_UP; } -@@ -210,19 +201,11 @@ static void cleanup_func(void *data) +@@ -209,19 +200,11 @@ static void cleanup_func(void *data) rcu_unregister_thread(); } @@ -135,10 +135,19 @@ index d173648..abda162 100644 /* * Async mode +@@ -341,7 +318,7 @@ int libcheck_check(struct checker * c) + pthread_mutex_unlock(&ct->lock); + condlog(3, "%d:%d : tur checker failing back to sync", + major(ct->devt), minor(ct->devt)); +- return tur_check(c->fd, c->timeout, copy_msg_to_checker, c); ++ return tur_check(c->fd, c->timeout, c->message); + } + /* Start new TUR checker */ + ct->state = PATH_UNCHECKED; @@ -360,8 +337,7 @@ int libcheck_check(struct checker * c) pthread_mutex_unlock(&ct->lock); - condlog(3, "%s: failed to start tur thread, using" - " sync mode", ct->devt); + condlog(3, "%d:%d : failed to start tur thread, using" + " sync mode", major(ct->devt), minor(ct->devt)); - return tur_check(c->fd, c->timeout, - copy_msg_to_checker, c); + return tur_check(c->fd, c->timeout, c->message); diff --git a/0004-libmultipath-cleanup-tur-locking.patch b/0005-libmultipath-cleanup-tur-locking.patch similarity index 80% rename from 0004-libmultipath-cleanup-tur-locking.patch rename to 0005-libmultipath-cleanup-tur-locking.patch index a75e54e..303e274 100644 --- a/0004-libmultipath-cleanup-tur-locking.patch +++ b/0005-libmultipath-cleanup-tur-locking.patch @@ -21,11 +21,11 @@ return PATH_PENDING. Signed-off-by: Benjamin Marzinski --- - libmultipath/checkers/tur.c | 49 ++++++++++++++++++--------------------------- - 1 file changed, 20 insertions(+), 29 deletions(-) + libmultipath/checkers/tur.c | 44 ++++++++++++++++---------------------------- + 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c -index abda162..9f6ef51 100644 +index 0c7b5ca..983ba4c 100644 --- a/libmultipath/checkers/tur.c +++ b/libmultipath/checkers/tur.c @@ -53,7 +53,6 @@ struct tur_checker_context { @@ -46,11 +46,11 @@ index abda162..9f6ef51 100644 - pthread_mutexattr_destroy(&attr); + pthread_mutex_init(&ct->lock, NULL); if (fstat(c->fd, &sb) == 0) - snprintf(ct->devt, sizeof(ct->devt), "%d:%d", major(sb.st_rdev), - minor(sb.st_rdev)); + ct->devt = sb.st_rdev; + c->context = ct; @@ -213,12 +209,6 @@ static void *tur_thread(void *ctx) - - condlog(3, "%s: tur checker starting up", ct->devt); + condlog(3, "%d:%d : tur checker starting up", major(ct->devt), + minor(ct->devt)); - /* TUR checker start up */ - pthread_mutex_lock(&ct->lock); @@ -75,7 +75,7 @@ index abda162..9f6ef51 100644 if (ct->thread) { if (tur_check_async_timeout(c)) { int running = uatomic_xchg(&ct->running, 0); -@@ -305,23 +288,29 @@ int libcheck_check(struct checker * c) +@@ -307,21 +290,24 @@ int libcheck_check(struct checker * c) } else { /* TUR checker done */ ct->thread = 0; @@ -87,18 +87,12 @@ index abda162..9f6ef51 100644 - pthread_mutex_unlock(&ct->lock); } else { if (uatomic_read(&ct->holders) > 1) { - /* pthread cancel failed. If it didn't get the path - state already, timeout */ -- if (ct->state == PATH_PENDING) { -- pthread_mutex_unlock(&ct->lock); -+ pthread_mutex_lock(&ct->lock); -+ tur_status = ct->state; -+ pthread_mutex_unlock(&ct->lock); -+ if (tur_status == PATH_PENDING) { - condlog(3, "%s: tur thread not responding", - ct->devt); - return PATH_TIMEOUT; - } + /* The thread has been cancelled but hasn't + * quilt. Fail back to synchronous mode */ +- pthread_mutex_unlock(&ct->lock); + condlog(3, "%d:%d : tur checker failing back to sync", + major(ct->devt), minor(ct->devt)); + return tur_check(c->fd, c->timeout, c->message); } /* Start new TUR checker */ - ct->state = PATH_UNCHECKED; @@ -109,13 +103,13 @@ index abda162..9f6ef51 100644 ct->fd = c->fd; ct->timeout = c->timeout; uatomic_add(&ct->holders, 1); -@@ -334,20 +323,22 @@ int libcheck_check(struct checker * c) +@@ -334,21 +320,23 @@ int libcheck_check(struct checker * c) uatomic_sub(&ct->holders, 1); uatomic_set(&ct->running, 0); ct->thread = 0; - pthread_mutex_unlock(&ct->lock); - condlog(3, "%s: failed to start tur thread, using" - " sync mode", ct->devt); + condlog(3, "%d:%d : failed to start tur thread, using" + " sync mode", major(ct->devt), minor(ct->devt)); return tur_check(c->fd, c->timeout, c->message); } tur_timeout(&tsp); @@ -134,7 +128,8 @@ index abda162..9f6ef51 100644 - if (uatomic_read(&ct->running) != 0 && - (tur_status == PATH_PENDING || tur_status == PATH_UNCHECKED)) { + if (tur_status == PATH_PENDING) { - condlog(3, "%s: tur checker still running", ct->devt); + condlog(3, "%d:%d : tur checker still running", + major(ct->devt), minor(ct->devt)); - tur_status = PATH_PENDING; } else { int running = uatomic_xchg(&ct->running, 0); diff --git a/0005-libmultipath-fix-tur-checker-timeout-issue.patch b/0006-libmultipath-fix-tur-checker-timeout-issue.patch similarity index 75% rename from 0005-libmultipath-fix-tur-checker-timeout-issue.patch rename to 0006-libmultipath-fix-tur-checker-timeout-issue.patch index ca7c5be..0fe2f5b 100644 --- a/0005-libmultipath-fix-tur-checker-timeout-issue.patch +++ b/0006-libmultipath-fix-tur-checker-timeout-issue.patch @@ -12,22 +12,24 @@ check if the thread completed, and if so, it returns the proper value. Signed-off-by: Benjamin Marzinski --- - libmultipath/checkers/tur.c | 15 +++++++++++---- - 1 file changed, 11 insertions(+), 4 deletions(-) + libmultipath/checkers/tur.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c -index 9f6ef51..4e2c7a8 100644 +index 983ba4c..86c0cdc 100644 --- a/libmultipath/checkers/tur.c +++ b/libmultipath/checkers/tur.c -@@ -276,12 +276,19 @@ int libcheck_check(struct checker * c) +@@ -276,13 +276,20 @@ int libcheck_check(struct checker * c) if (ct->thread) { if (tur_check_async_timeout(c)) { int running = uatomic_xchg(&ct->running, 0); - if (running) + if (running) { pthread_cancel(ct->thread); -- condlog(3, "%s: tur checker timeout", ct->devt); -+ condlog(3, "%s: tur checker timeout", ct->devt); +- condlog(3, "%d:%d : tur checker timeout", +- major(ct->devt), minor(ct->devt)); ++ condlog(3, "%d:%d : tur checker timeout", ++ major(ct->devt), minor(ct->devt)); + MSG(c, MSG_TUR_TIMEOUT); + tur_status = PATH_TIMEOUT; + } else { @@ -41,8 +43,8 @@ index 9f6ef51..4e2c7a8 100644 - MSG(c, MSG_TUR_TIMEOUT); - tur_status = PATH_TIMEOUT; } else if (uatomic_read(&ct->running) != 0) { - condlog(3, "%s: tur checker not finished", ct->devt); - tur_status = PATH_PENDING; + condlog(3, "%d:%d : tur checker not finished", + major(ct->devt), minor(ct->devt)); -- 2.7.4 diff --git a/0006-libmultipath-fix-set_int-error-path.patch b/0007-libmultipath-fix-set_int-error-path.patch similarity index 100% rename from 0006-libmultipath-fix-set_int-error-path.patch rename to 0007-libmultipath-fix-set_int-error-path.patch diff --git a/0007-libmultipath-fix-length-issues-in-get_vpd_sgio.patch b/0008-libmultipath-fix-length-issues-in-get_vpd_sgio.patch similarity index 98% rename from 0007-libmultipath-fix-length-issues-in-get_vpd_sgio.patch rename to 0008-libmultipath-fix-length-issues-in-get_vpd_sgio.patch index aea9ed1..e0f5088 100644 --- a/0007-libmultipath-fix-length-issues-in-get_vpd_sgio.patch +++ b/0008-libmultipath-fix-length-issues-in-get_vpd_sgio.patch @@ -15,7 +15,7 @@ Signed-off-by: Benjamin Marzinski 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c -index 0b1855d..3e0db7f 100644 +index f973d4b..301093f 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1116,17 +1116,21 @@ get_vpd_sgio (int fd, int pg, char * str, int maxlen) diff --git a/0008-libmultipath-_install_keyword-cleanup.patch b/0009-libmultipath-_install_keyword-cleanup.patch similarity index 100% rename from 0008-libmultipath-_install_keyword-cleanup.patch rename to 0009-libmultipath-_install_keyword-cleanup.patch diff --git a/0009-libmultipath-remove-unused-code.patch b/0010-libmultipath-remove-unused-code.patch similarity index 100% rename from 0009-libmultipath-remove-unused-code.patch rename to 0010-libmultipath-remove-unused-code.patch diff --git a/0010-libmultipath-fix-memory-issue-in-path_latency-prio.patch b/0011-libmultipath-fix-memory-issue-in-path_latency-prio.patch similarity index 100% rename from 0010-libmultipath-fix-memory-issue-in-path_latency-prio.patch rename to 0011-libmultipath-fix-memory-issue-in-path_latency-prio.patch diff --git a/0011-libmultipath-fix-null-dereference-int-alloc_path_gro.patch b/0012-libmultipath-fix-null-dereference-int-alloc_path_gro.patch similarity index 100% rename from 0011-libmultipath-fix-null-dereference-int-alloc_path_gro.patch rename to 0012-libmultipath-fix-null-dereference-int-alloc_path_gro.patch diff --git a/0012-libmutipath-don-t-use-malformed-uevents.patch b/0013-libmutipath-don-t-use-malformed-uevents.patch similarity index 100% rename from 0012-libmutipath-don-t-use-malformed-uevents.patch rename to 0013-libmutipath-don-t-use-malformed-uevents.patch diff --git a/0013-multipath-fix-max-array-size-in-print_cmd_valid.patch b/0014-multipath-fix-max-array-size-in-print_cmd_valid.patch similarity index 100% rename from 0013-multipath-fix-max-array-size-in-print_cmd_valid.patch rename to 0014-multipath-fix-max-array-size-in-print_cmd_valid.patch diff --git a/0014-multipathd-function-return-value-tweaks.patch b/0015-multipathd-function-return-value-tweaks.patch similarity index 100% rename from 0014-multipathd-function-return-value-tweaks.patch rename to 0015-multipathd-function-return-value-tweaks.patch diff --git a/0015-multipathd-minor-fixes.patch b/0016-multipathd-minor-fixes.patch similarity index 93% rename from 0015-multipathd-minor-fixes.patch rename to 0016-multipathd-minor-fixes.patch index b58a9c3..445870d 100644 --- a/0015-multipathd-minor-fixes.patch +++ b/0016-multipathd-minor-fixes.patch @@ -14,7 +14,7 @@ Signed-off-by: Benjamin Marzinski 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c -index cc493c1..125a805 100644 +index ba796ab..cd96304 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -429,7 +429,7 @@ int update_multipath (struct vectors *vecs, char *mapname, int reset) @@ -26,7 +26,7 @@ index cc493c1..125a805 100644 int oldstate = pp->state; int checkint; -@@ -1096,7 +1096,7 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) +@@ -1097,7 +1097,7 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) /* * flush_map will fail if the device is open */ diff --git a/0016-multipathd-remove-useless-check-and-fix-format.patch b/0017-multipathd-remove-useless-check-and-fix-format.patch similarity index 93% rename from 0016-multipathd-remove-useless-check-and-fix-format.patch rename to 0017-multipathd-remove-useless-check-and-fix-format.patch index acf3175..1487fe4 100644 --- a/0016-multipathd-remove-useless-check-and-fix-format.patch +++ b/0017-multipathd-remove-useless-check-and-fix-format.patch @@ -14,10 +14,10 @@ Signed-off-by: Benjamin Marzinski 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c -index 125a805..3c2fe7b 100644 +index cd96304..463b1b8 100644 --- a/multipathd/main.c +++ b/multipathd/main.c -@@ -1978,14 +1978,14 @@ check_path (struct vectors * vecs, struct path * pp, int ticks) +@@ -1979,14 +1979,14 @@ check_path (struct vectors * vecs, struct path * pp, int ticks) return 1; } diff --git a/0017-multipathd-fix-memory-leak-on-error-in-configure.patch b/0018-multipathd-fix-memory-leak-on-error-in-configure.patch similarity index 80% rename from 0017-multipathd-fix-memory-leak-on-error-in-configure.patch rename to 0018-multipathd-fix-memory-leak-on-error-in-configure.patch index 60c19dc..a599b3f 100644 --- a/0017-multipathd-fix-memory-leak-on-error-in-configure.patch +++ b/0018-multipathd-fix-memory-leak-on-error-in-configure.patch @@ -12,10 +12,10 @@ Signed-off-by: Benjamin Marzinski 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c -index 3c2fe7b..61ca455 100644 +index 463b1b8..04dce04 100644 --- a/multipathd/main.c +++ b/multipathd/main.c -@@ -2277,7 +2277,7 @@ configure (struct vectors * vecs) +@@ -2278,7 +2278,7 @@ configure (struct vectors * vecs) ret = path_discovery(vecs->pathvec, DI_ALL); if (ret < 0) { condlog(0, "configure failed at path discovery"); @@ -24,7 +24,7 @@ index 3c2fe7b..61ca455 100644 } vector_foreach_slot (vecs->pathvec, pp, i){ -@@ -2294,7 +2294,7 @@ configure (struct vectors * vecs) +@@ -2295,7 +2295,7 @@ configure (struct vectors * vecs) } if (map_discovery(vecs)) { condlog(0, "configure failed at map discovery"); @@ -33,7 +33,7 @@ index 3c2fe7b..61ca455 100644 } /* -@@ -2308,7 +2308,7 @@ configure (struct vectors * vecs) +@@ -2309,7 +2309,7 @@ configure (struct vectors * vecs) force_reload = FORCE_RELOAD_YES; if (ret) { condlog(0, "configure failed while coalescing paths"); @@ -42,7 +42,7 @@ index 3c2fe7b..61ca455 100644 } /* -@@ -2317,7 +2317,7 @@ configure (struct vectors * vecs) +@@ -2318,7 +2318,7 @@ configure (struct vectors * vecs) */ if (coalesce_maps(vecs, mpvec)) { condlog(0, "configure failed while coalescing maps"); @@ -51,7 +51,7 @@ index 3c2fe7b..61ca455 100644 } dm_lib_release(); -@@ -2353,6 +2353,10 @@ configure (struct vectors * vecs) +@@ -2354,6 +2354,10 @@ configure (struct vectors * vecs) i--; } return 0; diff --git a/0018-libmultipath-Don-t-blank-intialized-paths.patch b/0019-libmultipath-Don-t-blank-intialized-paths.patch similarity index 94% rename from 0018-libmultipath-Don-t-blank-intialized-paths.patch rename to 0019-libmultipath-Don-t-blank-intialized-paths.patch index 37a8243..61dad27 100644 --- a/0018-libmultipath-Don-t-blank-intialized-paths.patch +++ b/0019-libmultipath-Don-t-blank-intialized-paths.patch @@ -15,10 +15,10 @@ Signed-off-by: Benjamin Marzinski 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c -index 3e0db7f..33815dc 100644 +index 301093f..b267f07 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c -@@ -1991,9 +1991,9 @@ blank: +@@ -2004,9 +2004,9 @@ blank: /* * Recoverable error, for example faulty or offline path */ diff --git a/0019-libmultipath-Fixup-updating-paths.patch b/0020-libmultipath-Fixup-updating-paths.patch similarity index 91% rename from 0019-libmultipath-Fixup-updating-paths.patch rename to 0020-libmultipath-Fixup-updating-paths.patch index b8bef98..2bc4017 100644 --- a/0019-libmultipath-Fixup-updating-paths.patch +++ b/0020-libmultipath-Fixup-updating-paths.patch @@ -33,10 +33,10 @@ Signed-off-by: Benjamin Marzinski 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c -index 61ca455..d6d122a 100644 +index 04dce04..af33239 100644 --- a/multipathd/main.c +++ b/multipathd/main.c -@@ -1207,6 +1207,15 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) +@@ -1208,6 +1208,15 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) struct multipath *mpp = pp->mpp; char wwid[WWID_SIZE]; @@ -52,7 +52,7 @@ index 61ca455..d6d122a 100644 strcpy(wwid, pp->wwid); get_uid(pp, pp->state, uev->udev); -@@ -1215,9 +1224,8 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) +@@ -1216,9 +1225,8 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) uev->kernel, wwid, pp->wwid, (disable_changed_wwids ? "disallowing" : "continuing")); @@ -64,7 +64,7 @@ index 61ca455..d6d122a 100644 if (!pp->wwid_changed) { pp->wwid_changed = 1; pp->tick = 1; -@@ -1225,11 +1233,9 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) +@@ -1226,11 +1234,9 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) dm_fail_path(pp->mpp->alias, pp->dev_t); } goto out; @@ -78,7 +78,7 @@ index 61ca455..d6d122a 100644 udev_device_unref(pp->udev); pp->udev = udev_device_ref(uev->udev); conf = get_multipath_config(); -@@ -1240,9 +1246,7 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) +@@ -1241,9 +1247,7 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) pthread_cleanup_pop(1); } diff --git a/0020-multipath-tweak-logging-style.patch b/0021-multipath-tweak-logging-style.patch similarity index 92% rename from 0020-multipath-tweak-logging-style.patch rename to 0021-multipath-tweak-logging-style.patch index 121e734..1ba1b7a 100644 --- a/0020-multipath-tweak-logging-style.patch +++ b/0021-multipath-tweak-logging-style.patch @@ -35,10 +35,10 @@ index 8136d15..0433b49 100644 condlog(level, "libdevmapper: %s(%i): ", file, line); log_safe(level + 3, f, ap); diff --git a/multipathd/main.c b/multipathd/main.c -index d6d122a..3c1d89f 100644 +index af33239..5f0193b 100644 --- a/multipathd/main.c +++ b/multipathd/main.c -@@ -2983,6 +2983,7 @@ main (int argc, char *argv[]) +@@ -2984,6 +2984,7 @@ main (int argc, char *argv[]) logsink = -1; break; case 'k': @@ -46,7 +46,7 @@ index d6d122a..3c1d89f 100644 conf = load_config(DEFAULT_CONFIGFILE); if (!conf) exit(1); -@@ -3012,6 +3013,7 @@ main (int argc, char *argv[]) +@@ -3013,6 +3014,7 @@ main (int argc, char *argv[]) char * s = cmd; char * c = s; diff --git a/0022-multipathd-check-for-NULL-udevice-in-cli_add_path.patch b/0022-multipathd-check-for-NULL-udevice-in-cli_add_path.patch new file mode 100644 index 0000000..ccfc1ef --- /dev/null +++ b/0022-multipathd-check-for-NULL-udevice-in-cli_add_path.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +Date: Fri, 5 Oct 2018 17:20:38 -0500 +Subject: [PATCH] multipathd: check for NULL udevice in cli_add_path + +If cli_add_path can't get a udevice for the path, it should fail, +instead of continuing with a NULL udevice. + +Signed-off-by: Benjamin Marzinski +--- + multipathd/cli_handlers.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c +index bb16472..7500080 100644 +--- a/multipathd/cli_handlers.c ++++ b/multipathd/cli_handlers.c +@@ -720,6 +720,10 @@ cli_add_path (void * v, char ** reply, int * len, void * data) + udevice = udev_device_new_from_subsystem_sysname(udev, + "block", + param); ++ if (!udevice) { ++ condlog(0, "%s: can't find path", param); ++ return 1; ++ } + conf = get_multipath_config(); + pthread_cleanup_push(put_multipath_config, conf); + r = store_pathinfo(vecs->pathvec, conf, +-- +2.7.4 + diff --git a/0023-libmultipath-remove-max_fds-code-duplication.patch b/0023-libmultipath-remove-max_fds-code-duplication.patch new file mode 100644 index 0000000..cc3621a --- /dev/null +++ b/0023-libmultipath-remove-max_fds-code-duplication.patch @@ -0,0 +1,188 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +Date: Mon, 8 Oct 2018 11:41:03 -0500 +Subject: [PATCH] libmultipath: remove max_fds code duplication + +Instead of multipath, multipathd, and mpathpersist all having code to +set the max number of open file descriptors, just use a util function to +do it. + +Signed-off-by: Benjamin Marzinski +--- + libmpathpersist/mpath_persist.c | 11 +---------- + libmultipath/util.c | 31 +++++++++++++++++++++++++++++++ + libmultipath/util.h | 1 + + multipath/main.c | 12 +----------- + multipathd/main.c | 31 +++---------------------------- + 5 files changed, 37 insertions(+), 49 deletions(-) + +diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c +index 4229a94..29e7fb4 100644 +--- a/libmpathpersist/mpath_persist.c ++++ b/libmpathpersist/mpath_persist.c +@@ -31,7 +31,6 @@ + #include + #include + #include +-#include + + #define __STDC_FORMAT_MACROS 1 + +@@ -48,15 +47,7 @@ mpath_lib_init (void) + return NULL; + } + +- if (conf->max_fds) { +- struct rlimit fd_limit; +- +- fd_limit.rlim_cur = conf->max_fds; +- fd_limit.rlim_max = conf->max_fds; +- if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) +- condlog(0, "can't set open fds limit to %d : %s", +- conf->max_fds, strerror(errno)); +- } ++ set_max_fds(conf->max_fds); + + return conf; + } +diff --git a/libmultipath/util.c b/libmultipath/util.c +index 347af5b..d08112d 100644 +--- a/libmultipath/util.c ++++ b/libmultipath/util.c +@@ -7,6 +7,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -465,3 +467,32 @@ int safe_write(int fd, const void *buf, size_t count) + } + return 0; + } ++ ++void set_max_fds(int max_fds) ++{ ++ struct rlimit fd_limit; ++ ++ if (!max_fds) ++ return; ++ ++ if (getrlimit(RLIMIT_NOFILE, &fd_limit) < 0) { ++ condlog(0, "can't get open fds limit: %s", ++ strerror(errno)); ++ fd_limit.rlim_cur = 0; ++ fd_limit.rlim_max = 0; ++ } ++ if (fd_limit.rlim_cur < max_fds) { ++ fd_limit.rlim_cur = max_fds; ++ if (fd_limit.rlim_max < max_fds) ++ fd_limit.rlim_max = max_fds; ++ if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) { ++ condlog(0, "can't set open fds limit to " ++ "%lu/%lu : %s", ++ fd_limit.rlim_cur, fd_limit.rlim_max, ++ strerror(errno)); ++ } else { ++ condlog(3, "set open fds limit to %lu/%lu", ++ fd_limit.rlim_cur, fd_limit.rlim_max); ++ } ++ } ++} +diff --git a/libmultipath/util.h b/libmultipath/util.h +index 56cec76..c246295 100644 +--- a/libmultipath/util.h ++++ b/libmultipath/util.h +@@ -21,6 +21,7 @@ int get_linux_version_code(void); + int parse_prkey(char *ptr, uint64_t *prkey); + int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags); + int safe_write(int fd, const void *buf, size_t count); ++void set_max_fds(int max_fds); + + #define KERNEL_VERSION(maj, min, ptc) ((((maj) * 256) + (min)) * 256 + (ptc)) + +diff --git a/multipath/main.c b/multipath/main.c +index d5aad95..05b7bf0 100644 +--- a/multipath/main.c ++++ b/multipath/main.c +@@ -56,8 +56,6 @@ + #include "pgpolicies.h" + #include "version.h" + #include +-#include +-#include + #include "wwids.h" + #include "uxsock.h" + #include "mpath_cmd.h" +@@ -1002,15 +1000,7 @@ main (int argc, char *argv[]) + logsink = 1; + } + +- if (conf->max_fds) { +- struct rlimit fd_limit; +- +- fd_limit.rlim_cur = conf->max_fds; +- fd_limit.rlim_max = conf->max_fds; +- if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) +- condlog(0, "can't set open fds limit to %d : %s", +- conf->max_fds, strerror(errno)); +- } ++ set_max_fds(conf->max_fds); + + libmp_udev_set_sync_support(1); + +diff --git a/multipathd/main.c b/multipathd/main.c +index 5f0193b..d3f7719 100644 +--- a/multipathd/main.c ++++ b/multipathd/main.c +@@ -12,8 +12,6 @@ + #include + #include + #include +-#include +-#include + #include + #include + #include +@@ -2663,33 +2661,10 @@ child (void * param) + + envp = getenv("LimitNOFILE"); + +- if (envp) { ++ if (envp) + condlog(2,"Using systemd provided open fds limit of %s", envp); +- } else if (conf->max_fds) { +- struct rlimit fd_limit; +- +- if (getrlimit(RLIMIT_NOFILE, &fd_limit) < 0) { +- condlog(0, "can't get open fds limit: %s", +- strerror(errno)); +- fd_limit.rlim_cur = 0; +- fd_limit.rlim_max = 0; +- } +- if (fd_limit.rlim_cur < conf->max_fds) { +- fd_limit.rlim_cur = conf->max_fds; +- if (fd_limit.rlim_max < conf->max_fds) +- fd_limit.rlim_max = conf->max_fds; +- if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) { +- condlog(0, "can't set open fds limit to " +- "%lu/%lu : %s", +- fd_limit.rlim_cur, fd_limit.rlim_max, +- strerror(errno)); +- } else { +- condlog(3, "set open fds limit to %lu/%lu", +- fd_limit.rlim_cur, fd_limit.rlim_max); +- } +- } +- +- } ++ else ++ set_max_fds(conf->max_fds); + + vecs = gvecs = init_vecs(); + if (!vecs) +-- +2.7.4 + diff --git a/0024-multipathd-set-return-code-for-multipathd-commands.patch b/0024-multipathd-set-return-code-for-multipathd-commands.patch new file mode 100644 index 0000000..4ef2265 --- /dev/null +++ b/0024-multipathd-set-return-code-for-multipathd-commands.patch @@ -0,0 +1,98 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +Date: Mon, 8 Oct 2018 14:49:30 -0500 +Subject: [PATCH] multipathd: set return code for multipathd commands + +Failed multipathd commands should set the return code to 1. + +Signed-off-by: Benjamin Marzinski +--- + multipathd/main.c | 8 ++++---- + multipathd/uxclnt.c | 13 ++++++++----- + 2 files changed, 12 insertions(+), 9 deletions(-) + +diff --git a/multipathd/main.c b/multipathd/main.c +index d3f7719..2d45d98 100644 +--- a/multipathd/main.c ++++ b/multipathd/main.c +@@ -2966,9 +2966,9 @@ main (int argc, char *argv[]) + if (verbosity) + conf->verbosity = verbosity; + uxsock_timeout = conf->uxsock_timeout; +- uxclnt(optarg, uxsock_timeout + 100); ++ err = uxclnt(optarg, uxsock_timeout + 100); + free_config(conf); +- exit(0); ++ return err; + case 'B': + bindings_read_only = 1; + break; +@@ -3005,9 +3005,9 @@ main (int argc, char *argv[]) + optind++; + } + c += snprintf(c, s + CMDSIZE - c, "\n"); +- uxclnt(s, uxsock_timeout + 100); ++ err = uxclnt(s, uxsock_timeout + 100); + free_config(conf); +- exit(0); ++ return err; + } + + if (foreground) { +diff --git a/multipathd/uxclnt.c b/multipathd/uxclnt.c +index 08db0e8..a76f8e2 100644 +--- a/multipathd/uxclnt.c ++++ b/multipathd/uxclnt.c +@@ -103,14 +103,14 @@ static void process(int fd, unsigned int timeout) + } + } + +-static void process_req(int fd, char * inbuf, unsigned int timeout) ++static int process_req(int fd, char * inbuf, unsigned int timeout) + { + char *reply; + int ret; + + if (send_packet(fd, inbuf) != 0) { + printf("cannot send packet\n"); +- return; ++ return 1; + } + ret = recv_packet(fd, &reply, timeout); + if (ret < 0) { +@@ -118,9 +118,12 @@ static void process_req(int fd, char * inbuf, unsigned int timeout) + printf("timeout receiving packet\n"); + else + printf("error %d receiving packet\n", ret); ++ return 1; + } else { + printf("%s", reply); ++ ret = (strcmp(reply, "fail\n") == 0); + FREE(reply); ++ return ret; + } + } + +@@ -129,16 +132,16 @@ static void process_req(int fd, char * inbuf, unsigned int timeout) + */ + int uxclnt(char * inbuf, unsigned int timeout) + { +- int fd; ++ int fd, ret = 0; + + fd = mpath_connect(); + if (fd == -1) + exit(1); + + if (inbuf) +- process_req(fd, inbuf, timeout); ++ ret = process_req(fd, inbuf, timeout); + else + process(fd, timeout); + mpath_disconnect(fd); +- return 0; ++ return ret; + } +-- +2.7.4 + diff --git a/0025-mpathpersist-fix-registration-rollback-issue.patch b/0025-mpathpersist-fix-registration-rollback-issue.patch new file mode 100644 index 0000000..3cba08d --- /dev/null +++ b/0025-mpathpersist-fix-registration-rollback-issue.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +Date: Mon, 8 Oct 2018 16:45:11 -0500 +Subject: [PATCH] mpathpersist: fix registration rollback issue + +When mpathpersist tries to rollback the registration, it copies +the SARK to the RK, and clears the SARK. However, it repeated this step +for each thread. This means that the first rollback thread correctly +had the RK set to the SARK used during registration. However, if more +than one registration needed to be rolled back, later threads would have +both the RK and SARK cleared. This commit fixes that by only copying and +clearing the SARK once. + +Signed-off-by: Benjamin Marzinski +--- + libmpathpersist/mpath_persist.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c +index 29e7fb4..2ffe56e 100644 +--- a/libmpathpersist/mpath_persist.c ++++ b/libmpathpersist/mpath_persist.c +@@ -559,11 +559,10 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope, + } + if (rollback && ((rq_servact == MPATH_PROUT_REG_SA) && sa_key != 0 )){ + condlog (3, "%s: ERROR: initiating pr out rollback", mpp->wwid); ++ memcpy(¶mp->key, ¶mp->sa_key, 8); ++ memset(¶mp->sa_key, 0, 8); + for( i=0 ; i < count ; i++){ + if(thread[i].param.status == MPATH_PR_SUCCESS) { +- memcpy(&thread[i].param.paramp->key, &thread[i].param.paramp->sa_key, 8); +- memset(&thread[i].param.paramp->sa_key, 0, 8); +- thread[i].param.status = MPATH_PR_SUCCESS; + rc = pthread_create(&thread[i].id, &attr, mpath_prout_pthread_fn, + (void *)(&thread[i].param)); + if (rc){ +-- +2.7.4 + diff --git a/0021-RH-fixup-udev-rules-for-redhat.patch b/0026-RH-fixup-udev-rules-for-redhat.patch similarity index 96% rename from 0021-RH-fixup-udev-rules-for-redhat.patch rename to 0026-RH-fixup-udev-rules-for-redhat.patch index 8f08ae2..b3e4428 100644 --- a/0021-RH-fixup-udev-rules-for-redhat.patch +++ b/0026-RH-fixup-udev-rules-for-redhat.patch @@ -65,10 +65,10 @@ index 0828a8f..b9bbb3c 100644 $(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz diff --git a/multipath/main.c b/multipath/main.c -index d5aad95..8086b76 100644 +index 05b7bf0..ffa5b22 100644 --- a/multipath/main.c +++ b/multipath/main.c -@@ -403,7 +403,7 @@ static int find_multipaths_check_timeout(const struct path *pp, long tmo, +@@ -401,7 +401,7 @@ static int find_multipaths_check_timeout(const struct path *pp, long tmo, struct timespec now, ftimes[2], tdiff; struct stat st; long fd; diff --git a/0022-RH-Remove-the-property-blacklist-exception-builtin.patch b/0027-RH-Remove-the-property-blacklist-exception-builtin.patch similarity index 100% rename from 0022-RH-Remove-the-property-blacklist-exception-builtin.patch rename to 0027-RH-Remove-the-property-blacklist-exception-builtin.patch diff --git a/0023-RH-don-t-start-without-a-config-file.patch b/0028-RH-don-t-start-without-a-config-file.patch similarity index 100% rename from 0023-RH-don-t-start-without-a-config-file.patch rename to 0028-RH-don-t-start-without-a-config-file.patch diff --git a/0024-RH-use-rpm-optflags-if-present.patch b/0029-RH-use-rpm-optflags-if-present.patch similarity index 100% rename from 0024-RH-use-rpm-optflags-if-present.patch rename to 0029-RH-use-rpm-optflags-if-present.patch diff --git a/0025-RH-add-mpathconf.patch b/0030-RH-add-mpathconf.patch similarity index 100% rename from 0025-RH-add-mpathconf.patch rename to 0030-RH-add-mpathconf.patch diff --git a/0026-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch b/0031-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch similarity index 96% rename from 0026-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch rename to 0031-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch index 546c7c5..d7c4c8a 100644 --- a/0026-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch +++ b/0031-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch @@ -86,10 +86,10 @@ index 0c6ee54..e32a0b0 100644 enum { WWID_IS_NOT_FAILED = 0, diff --git a/multipath/main.c b/multipath/main.c -index 8086b76..85b60e8 100644 +index ffa5b22..ccb6091 100644 --- a/multipath/main.c +++ b/multipath/main.c -@@ -122,7 +122,7 @@ usage (char * progname) +@@ -120,7 +120,7 @@ usage (char * progname) { fprintf (stderr, VERSION_STRING); fprintf (stderr, "Usage:\n"); @@ -98,7 +98,7 @@ index 8086b76..85b60e8 100644 fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [-R num] [dev]\n", progname); fprintf (stderr, " %s -F [-v lvl] [-R num]\n", progname); fprintf (stderr, " %s [-t|-T]\n", progname); -@@ -136,6 +136,8 @@ usage (char * progname) +@@ -134,6 +134,8 @@ usage (char * progname) " -f flush a multipath device map\n" " -F flush all multipath device maps\n" " -a add a device wwid to the wwids file\n" @@ -107,7 +107,7 @@ index 8086b76..85b60e8 100644 " -c check if a device should be a path in a multipath device\n" " -C check if a multipath device has usable paths\n" " -q allow queue_if_no_path when multipathd is not running\n" -@@ -870,7 +872,7 @@ main (int argc, char *argv[]) +@@ -868,7 +870,7 @@ main (int argc, char *argv[]) exit(1); multipath_conf = conf; conf->retrigger_tries = 0; @@ -116,7 +116,7 @@ index 8086b76..85b60e8 100644 switch(arg) { case 1: printf("optarg : %s\n",optarg); break; -@@ -940,6 +942,10 @@ main (int argc, char *argv[]) +@@ -938,6 +940,10 @@ main (int argc, char *argv[]) case 'T': cmd = CMD_DUMP_CONFIG; break; diff --git a/0027-RH-warn-on-invalid-regex-instead-of-failing.patch b/0032-RH-warn-on-invalid-regex-instead-of-failing.patch similarity index 100% rename from 0027-RH-warn-on-invalid-regex-instead-of-failing.patch rename to 0032-RH-warn-on-invalid-regex-instead-of-failing.patch diff --git a/0028-RH-reset-default-find_mutipaths-value-to-off.patch b/0033-RH-reset-default-find_mutipaths-value-to-off.patch similarity index 100% rename from 0028-RH-reset-default-find_mutipaths-value-to-off.patch rename to 0033-RH-reset-default-find_mutipaths-value-to-off.patch diff --git a/device-mapper-multipath.spec b/device-mapper-multipath.spec index 1d00631..942c4d2 100644 --- a/device-mapper-multipath.spec +++ b/device-mapper-multipath.spec @@ -1,43 +1,48 @@ Name: device-mapper-multipath Version: 0.7.7 -Release: 6.git1a8625a%{?dist} +Release: 7.gitb80318b%{?dist} Summary: Tools to manage multipath devices using device-mapper License: GPLv2 URL: http://christophe.varoqui.free.fr/ # The source for this package was pulled from upstream's git repo. Use the # following command to generate the tarball -# curl "https://git.opensvc.com/?p=multipath-tools/.git;a=snapshot;h=ef6d98b;sf=tgz" -o multipath-tools-ef6d98b.tgz -Source0: multipath-tools-1a8625a.tgz +# curl "https://git.opensvc.com/?p=multipath-tools/.git;a=snapshot;h=b80318b;sf=tgz" -o multipath-tools-b80318b.tgz +Source0: multipath-tools-b80318b.tgz Source1: multipath.conf -Patch0001: 0001-libmultipath-fix-tur-checker-timeout.patch -Patch0002: 0002-libmultipath-fix-tur-checker-double-locking.patch -Patch0003: 0003-libmultipath-fix-tur-memory-misuse.patch -Patch0004: 0004-libmultipath-cleanup-tur-locking.patch -Patch0005: 0005-libmultipath-fix-tur-checker-timeout-issue.patch -Patch0006: 0006-libmultipath-fix-set_int-error-path.patch -Patch0007: 0007-libmultipath-fix-length-issues-in-get_vpd_sgio.patch -Patch0008: 0008-libmultipath-_install_keyword-cleanup.patch -Patch0009: 0009-libmultipath-remove-unused-code.patch -Patch0010: 0010-libmultipath-fix-memory-issue-in-path_latency-prio.patch -Patch0011: 0011-libmultipath-fix-null-dereference-int-alloc_path_gro.patch -Patch0012: 0012-libmutipath-don-t-use-malformed-uevents.patch -Patch0013: 0013-multipath-fix-max-array-size-in-print_cmd_valid.patch -Patch0014: 0014-multipathd-function-return-value-tweaks.patch -Patch0015: 0015-multipathd-minor-fixes.patch -Patch0016: 0016-multipathd-remove-useless-check-and-fix-format.patch -Patch0017: 0017-multipathd-fix-memory-leak-on-error-in-configure.patch -Patch0018: 0018-libmultipath-Don-t-blank-intialized-paths.patch -Patch0019: 0019-libmultipath-Fixup-updating-paths.patch -Patch0020: 0020-multipath-tweak-logging-style.patch -Patch0021: 0021-RH-fixup-udev-rules-for-redhat.patch -Patch0022: 0022-RH-Remove-the-property-blacklist-exception-builtin.patch -Patch0023: 0023-RH-don-t-start-without-a-config-file.patch -Patch0024: 0024-RH-use-rpm-optflags-if-present.patch -Patch0025: 0025-RH-add-mpathconf.patch -Patch0026: 0026-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch -Patch0027: 0027-RH-warn-on-invalid-regex-instead-of-failing.patch -Patch0028: 0028-RH-reset-default-find_mutipaths-value-to-off.patch +Patch0001: 0001-kpartx-Use-absolute-paths-to-create-mappings.patch +Patch0002: 0002-libmultipath-fix-tur-checker-timeout.patch +Patch0003: 0003-libmultipath-fix-tur-checker-double-locking.patch +Patch0004: 0004-libmultipath-fix-tur-memory-misuse.patch +Patch0005: 0005-libmultipath-cleanup-tur-locking.patch +Patch0006: 0006-libmultipath-fix-tur-checker-timeout-issue.patch +Patch0007: 0007-libmultipath-fix-set_int-error-path.patch +Patch0008: 0008-libmultipath-fix-length-issues-in-get_vpd_sgio.patch +Patch0009: 0009-libmultipath-_install_keyword-cleanup.patch +Patch0010: 0010-libmultipath-remove-unused-code.patch +Patch0011: 0011-libmultipath-fix-memory-issue-in-path_latency-prio.patch +Patch0012: 0012-libmultipath-fix-null-dereference-int-alloc_path_gro.patch +Patch0013: 0013-libmutipath-don-t-use-malformed-uevents.patch +Patch0014: 0014-multipath-fix-max-array-size-in-print_cmd_valid.patch +Patch0015: 0015-multipathd-function-return-value-tweaks.patch +Patch0016: 0016-multipathd-minor-fixes.patch +Patch0017: 0017-multipathd-remove-useless-check-and-fix-format.patch +Patch0018: 0018-multipathd-fix-memory-leak-on-error-in-configure.patch +Patch0019: 0019-libmultipath-Don-t-blank-intialized-paths.patch +Patch0020: 0020-libmultipath-Fixup-updating-paths.patch +Patch0021: 0021-multipath-tweak-logging-style.patch +Patch0022: 0022-multipathd-check-for-NULL-udevice-in-cli_add_path.patch +Patch0023: 0023-libmultipath-remove-max_fds-code-duplication.patch +Patch0024: 0024-multipathd-set-return-code-for-multipathd-commands.patch +Patch0025: 0025-mpathpersist-fix-registration-rollback-issue.patch +Patch0026: 0026-RH-fixup-udev-rules-for-redhat.patch +Patch0027: 0027-RH-Remove-the-property-blacklist-exception-builtin.patch +Patch0028: 0028-RH-don-t-start-without-a-config-file.patch +Patch0029: 0029-RH-use-rpm-optflags-if-present.patch +Patch0030: 0030-RH-add-mpathconf.patch +Patch0031: 0031-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch +Patch0032: 0032-RH-warn-on-invalid-regex-instead-of-failing.patch +Patch0033: 0033-RH-reset-default-find_mutipaths-value-to-off.patch # runtime Requires: %{name}-libs = %{version}-%{release} @@ -120,7 +125,7 @@ This package contains the files needed to develop applications that use device-mapper-multipath's libdmmp C API library %prep -%setup -q -n multipath-tools-1a8625a +%setup -q -n multipath-tools-b80318b %patch0001 -p1 %patch0002 -p1 %patch0003 -p1 @@ -149,6 +154,11 @@ device-mapper-multipath's libdmmp C API library %patch0026 -p1 %patch0027 -p1 %patch0028 -p1 +%patch0029 -p1 +%patch0030 -p1 +%patch0031 -p1 +%patch0032 -p1 +%patch0033 -p1 cp %{SOURCE1} . %build @@ -264,6 +274,18 @@ fi %{_pkgconfdir}/libdmmp.pc %changelog +* Tue Oct 9 2018 Benjamin Marzinski 0.7.7-7.gitb80318b +- Update Source to latest upstream commit +- Rename files + * Previous patches 0001-0020 are now patches 0002-0021 + * Previous patches 0021-0028 are now patches 0026-0033 +- Add 0001-kpartx-Use-absolute-paths-to-create-mappings.patch +- Add 0022-multipathd-check-for-NULL-udevice-in-cli_add_path.patch +- Add 0023-libmultipath-remove-max_fds-code-duplication.patch +- Add 0024-multipathd-set-return-code-for-multipathd-commands.patch +- Add 0025-mpathpersist-fix-registration-rollback-issue.patch + * The above 5 patches have been submitted upstream + * Thu Sep 27 2018 Benjamin Marzinski 0.7.7-6.git1a8625a - Update Source to latest upstream commit * Previous patches 0001-0011 are included in this commit diff --git a/sources b/sources index 90a35d5..30c7351 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (multipath-tools-1a8625a.tgz) = fc7763ec80f8df9ddafd2510dcc8cdc72f6870e5b3bad17e5580126042b5b4a3f4cbeb6517eb119c8ec82fed43dfd0def6a5e3cb60f08e7ad4f7802c169979ca +SHA512 (multipath-tools-b80318b.tgz) = 56fa87ea655c39f8edef35f6aa78e1f1c2b0c86e29e637b0e89761e02a67548cdf61cd6b62d62d78a797ff0c562ff4bdd0a5d03c13aeec6c1e80cac5a0a21f75 SHA512 (multipath.conf) = 71953dce5a68adcf60a942305f5a66023e6f4c4baf53b1bfdb4edf65ed5b8e03db804363c36d1dcfd85591f4766f52b515269904c53b84d7b076da0b80b09942