summaryrefslogtreecommitdiffstats
path: root/0048-RHBZ-592494-fix-user-configs.patch
blob: 1f89d1f927a0bad895b9de480c2b4f4499572f22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
 libmultipath/config.c |   50 +++++++++++++++++++++++---------------------------
 1 file changed, 23 insertions(+), 27 deletions(-)

Index: multipath-tools/libmultipath/config.c
===================================================================
--- multipath-tools.orig/libmultipath/config.c
+++ multipath-tools/libmultipath/config.c
@@ -24,33 +24,30 @@
 static int
 hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2)
 {
-	if (hwe1->vendor && hwe2->vendor && strcmp(hwe1->vendor, hwe2->vendor))
+	if (hwe1->vendor) {
+		if (!hwe2->vendor || strcmp(hwe1->vendor, hwe2->vendor))
+			return 1;
+	}
+	else if (hwe2->vendor)
 		return 1;
 
-	if (hwe1->product && hwe2->product && strcmp(hwe1->product, hwe2->product))
+	if (hwe1->product) {
+		if (!hwe2->product || strcmp(hwe1->product, hwe2->product))
+			return 1;
+	}
+	else if (hwe2->product)
 		return 1;
 
-	if (hwe1->revision && hwe2->revision && strcmp(hwe1->revision, hwe2->revision))
+	if (hwe1->revision) {
+ 		if (!hwe2->revision || strcmp(hwe1->revision, hwe2->revision))
+			return 1;
+	}
+	else if (hwe2->revision)
 		return 1;
 
 	return 0;
 }
 
-static struct hwentry *
-find_hwe_strmatch (vector hwtable, struct hwentry *hwe)
-{
-	int i;
-	struct hwentry *tmp, *ret = NULL;
-
-	vector_foreach_slot (hwtable, tmp, i) {
-		if (hwe_strmatch(tmp, hwe))
-			continue;
-		ret = tmp;
-		break;
-	}
-	return ret;
-}
-
 struct hwentry *
 find_hwe (vector hwtable, char * vendor, char * product, char * revision)
 {
@@ -264,15 +261,13 @@ set_param_str(char * str)
 }
 
 #define merge_str(s) \
-	if (hwe2->s) { \
-		if (hwe1->s) \
-			FREE(hwe1->s); \
+	if (!hwe1->s && hwe2->s) { \
 		if (!(hwe1->s = set_param_str(hwe2->s))) \
 			return 1; \
 	}
 
 #define merge_num(s) \
-	if (hwe2->s) \
+	if (!hwe1->s && hwe2->s) \
 		hwe1->s = hwe2->s
 
 
@@ -295,6 +290,10 @@ merge_hwe (struct hwentry * hwe1, struct
 	merge_num(rr_weight);
 	merge_num(no_path_retry);
 	merge_num(minio);
+	merge_num(pg_timeout);
+	merge_num(flush_on_last_del);
+	merge_num(fast_io_fail);
+	merge_num(dev_loss);
 
 	return 0;
 }
@@ -304,9 +303,6 @@ store_hwe (vector hwtable, struct hwentr
 {
 	struct hwentry * hwe;
 
-	if (find_hwe_strmatch(hwtable, dhwe))
-		return 0;
-
 	if (!(hwe = alloc_hwe()))
 		return 1;
 
@@ -463,8 +459,6 @@ load_config (char * file)
 		if (!conf->hwtable)
 			goto out;
 	}
-	if (setup_default_hwtable(conf->hwtable))
-		goto out;
 
 	/*
 	 * read the config file
@@ -494,6 +488,8 @@ load_config (char * file)
 			goto out;
 		}
 	}
+	if (setup_default_hwtable(conf->hwtable))
+		goto out;
 	/*
 	 * remove duplica in hwtable. config file takes precedence
 	 * over build-in hwtable