device-mapper-multipath/0058-RHBZ-601665-assemble-features.patch
Benjamin Marzinski b0ec4a42c8 Modify 0012-RH-udev-sync-support.patch
Modify 0021-RHBZ-548874-add-find-multipaths.patch
Modify 0022-RHBZ-557845-RHEL5-style-partitions.patch
Add 0025-RHBZ-508827-update-multipathd-manpage.patch through
    0101-RHBZ-631009-disable-udev-disk-rules-on-reload.patch
  * sync with current state of RHEL6. Next release should include a updated
    source tarball with most of these fixes rolled in.
Add 0102-RHBZ-690828-systemd-unit-file.patch
  * Add Jóhann B. Guðmundsson's unit file for systemd.
  * Add sub-package sysvinit for SysV init script.
Resolves: bz #690828
2011-07-15 12:25:48 -05:00

67 lines
1.8 KiB
Diff

---
libmultipath/dmparser.c | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
Index: multipath-tools/libmultipath/dmparser.c
===================================================================
--- multipath-tools.orig/libmultipath/dmparser.c
+++ multipath-tools/libmultipath/dmparser.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
#include "checkers.h"
#include "vector.h"
@@ -44,6 +45,40 @@ merge_words (char ** dst, char * word, i
return 0;
}
+char *
+assemble_features (struct multipath *mp)
+{
+ static char features[PARAMS_SIZE];
+ unsigned int nr_features;
+ char *ptr;
+
+ if (!conf->daemon || mp->no_path_retry == NO_PATH_RETRY_UNDEF ||
+ mp->no_path_retry == NO_PATH_RETRY_FAIL ||
+ strstr(mp->features, "queue_if_no_path"))
+ return mp->features;
+ if (18 > PARAMS_SIZE - 1 - strlen(mp->features)) {
+ fprintf(stderr, "not enough size to modify features\n");
+ return mp->features;
+ }
+ if (sscanf(mp->features, "%u", &nr_features) != 1) {
+ fprintf(stderr, "can't find number of features\n");
+ return mp->features;
+ }
+ ptr = mp->features;
+ while (isspace(*ptr))
+ ptr++;
+ if (*ptr == '\0') {
+ fprintf(stderr, "features is empty\n");
+ return mp->features;
+ }
+ while(*ptr != '\0' && !isspace(*ptr))
+ ptr++;
+
+ snprintf(features, PARAMS_SIZE, "%u%s queue_if_no_path",
+ nr_features + 1, ptr);
+ return features;
+}
+
/*
* Transforms the path group vector into a proper device map string
*/
@@ -62,7 +97,7 @@ assemble_map (struct multipath * mp)
freechar = sizeof(mp->params);
shift = snprintf(p, freechar, "%s %s %i %i",
- mp->features, mp->hwhandler,
+ assemble_features(mp), mp->hwhandler,
VECTOR_SIZE(mp->pg), mp->bestpg);
if (shift >= freechar) {