]>
Commit | Line | Data |
---|---|---|
dc01aad8 SS |
1 | From 8191fb07d8212e29ad44370abb60e174e1c34bb5 Mon Sep 17 00:00:00 2001 |
2 | From: Fabio M. Di Nitto <fdinitto@redhat.com> | |
3 | Date: Tue, 13 Oct 2009 08:15:15 +0200 | |
4 | Subject: [PATCH 01/12] RH: queue without daemon | |
5 | ||
6 | Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com> | |
7 | --- | |
8 | :100644 100644 50a728c... 86b1320... M libmultipath/config.h | |
9 | :100644 100644 ee4de68... 7888e8e... M libmultipath/dict.c | |
10 | :100644 100644 afd1246... 2e7a0d1... M libmultipath/structs.h | |
11 | :100644 100644 c222da4... 9afa615... M multipath.conf.annotated | |
12 | :100644 100644 3e0fd6e... 44d1329... M multipath.conf.synthetic | |
13 | :100644 100644 41a9bd0... 90de6df... M multipathd/main.c | |
14 | libmultipath/config.h | 1 + | |
15 | libmultipath/dict.c | 35 +++++++++++++++++++++++++++++++++++ | |
16 | libmultipath/structs.h | 6 ++++++ | |
17 | multipath.conf.annotated | 9 +++++++++ | |
18 | multipath.conf.synthetic | 1 + | |
19 | multipathd/main.c | 5 +++++ | |
20 | 6 files changed, 57 insertions(+), 0 deletions(-) | |
21 | ||
22 | Index: multipath-tools/libmultipath/config.h | |
23 | =================================================================== | |
24 | --- multipath-tools.orig/libmultipath/config.h | |
25 | +++ multipath-tools/libmultipath/config.h | |
26 | @@ -74,6 +74,7 @@ struct config { | |
27 | int pg_timeout; | |
28 | int max_fds; | |
29 | int force_reload; | |
30 | + int queue_without_daemon; | |
31 | int daemon; | |
32 | int flush_on_last_del; | |
33 | int attribute_flags; | |
34 | Index: multipath-tools/libmultipath/dict.c | |
35 | =================================================================== | |
36 | --- multipath-tools.orig/libmultipath/dict.c | |
37 | +++ multipath-tools/libmultipath/dict.c | |
38 | @@ -362,6 +362,28 @@ def_no_path_retry_handler(vector strvec) | |
39 | } | |
40 | ||
41 | static int | |
42 | +def_queue_without_daemon(vector strvec) | |
43 | +{ | |
44 | + char * buff; | |
45 | + | |
46 | + buff = set_value(strvec); | |
47 | + if (!buff) | |
48 | + return 1; | |
49 | + | |
50 | + if (!strncmp(buff, "off", 3) || !strncmp(buff, "no", 2) || | |
51 | + !strncmp(buff, "0", 1)) | |
52 | + conf->queue_without_daemon = QUE_NO_DAEMON_OFF; | |
53 | + else if (!strncmp(buff, "on", 2) || !strncmp(buff, "yes", 3) || | |
54 | + !strncmp(buff, "1", 1)) | |
55 | + conf->queue_without_daemon = QUE_NO_DAEMON_ON; | |
56 | + else | |
57 | + conf->queue_without_daemon = QUE_NO_DAEMON_UNDEF; | |
58 | + | |
59 | + free(buff); | |
60 | + return 0; | |
61 | +} | |
62 | + | |
63 | +static int | |
64 | def_pg_timeout_handler(vector strvec) | |
65 | { | |
66 | int pg_timeout; | |
67 | @@ -1944,6 +1966,18 @@ snprint_def_no_path_retry (char * buff, | |
68 | } | |
69 | ||
70 | static int | |
71 | +snprint_def_queue_without_daemon (char * buff, int len, void * data) | |
72 | +{ | |
73 | + switch (conf->queue_without_daemon) { | |
74 | + case QUE_NO_DAEMON_OFF: | |
75 | + return snprintf(buff, len, "no"); | |
76 | + case QUE_NO_DAEMON_ON: | |
77 | + return snprintf(buff, len, "yes"); | |
78 | + } | |
79 | + return 0; | |
80 | +} | |
81 | + | |
82 | +static int | |
83 | snprint_def_pg_timeout (char * buff, int len, void * data) | |
84 | { | |
85 | if (conf->pg_timeout == DEFAULT_PGTIMEOUT) | |
86 | @@ -2029,6 +2063,7 @@ init_keywords(void) | |
87 | install_keyword("max_fds", &max_fds_handler, &snprint_max_fds); | |
88 | install_keyword("rr_weight", &def_weight_handler, &snprint_def_rr_weight); | |
89 | install_keyword("no_path_retry", &def_no_path_retry_handler, &snprint_def_no_path_retry); | |
90 | + install_keyword("queue_without_daemon", &def_queue_without_daemon, &snprint_def_queue_without_daemon); | |
91 | install_keyword("pg_timeout", &def_pg_timeout_handler, &snprint_def_pg_timeout); | |
92 | install_keyword("flush_on_last_del", &def_flush_on_last_del_handler, &snprint_def_flush_on_last_del); | |
93 | install_keyword("user_friendly_names", &names_handler, &snprint_def_user_friendly_names); | |
94 | Index: multipath-tools/libmultipath/structs.h | |
95 | =================================================================== | |
96 | --- multipath-tools.orig/libmultipath/structs.h | |
97 | +++ multipath-tools/libmultipath/structs.h | |
98 | @@ -63,6 +63,12 @@ enum pgstates { | |
99 | PGSTATE_ACTIVE | |
100 | }; | |
101 | ||
102 | +enum queue_without_daemon_states { | |
103 | + QUE_NO_DAEMON_UNDEF, | |
104 | + QUE_NO_DAEMON_OFF, | |
105 | + QUE_NO_DAEMON_ON, | |
106 | +}; | |
107 | + | |
108 | enum pgtimeouts { | |
109 | PGTIMEOUT_UNDEF, | |
110 | PGTIMEOUT_NONE | |
111 | Index: multipath-tools/multipath.conf.annotated | |
112 | =================================================================== | |
113 | --- multipath-tools.orig/multipath.conf.annotated | |
114 | +++ multipath-tools/multipath.conf.annotated | |
115 | @@ -153,6 +153,15 @@ | |
116 | # no_path_retry queue | |
117 | # | |
118 | # # | |
119 | +# # name : queue_without_daemon | |
120 | +# # scope : multipathd | |
121 | +# # desc : If set to "no", multipathd will disable queueing for all | |
122 | +# # devices when it is shut down. | |
123 | +# # values : yes|no | |
124 | +# # default : yes | |
125 | +# queue_without_daemon no | |
126 | +# | |
127 | +# # | |
128 | # # name : user_friendly_names | |
129 | # # scope : multipath | |
130 | # # desc : If set to "yes", using the bindings file | |
131 | Index: multipath-tools/multipath.conf.synthetic | |
132 | =================================================================== | |
133 | --- multipath-tools.orig/multipath.conf.synthetic | |
134 | +++ multipath-tools/multipath.conf.synthetic | |
135 | @@ -16,6 +16,7 @@ | |
136 | # rr_weight priorities | |
137 | # failback immediate | |
138 | # no_path_retry fail | |
139 | +# queue_without_daemon no | |
140 | # user_friendly_names no | |
141 | # mode 644 | |
142 | # uid 0 | |
143 | Index: multipath-tools/multipathd/main.c | |
144 | =================================================================== | |
145 | --- multipath-tools.orig/multipathd/main.c | |
146 | +++ multipath-tools/multipathd/main.c | |
147 | @@ -1334,6 +1334,8 @@ child (void * param) | |
148 | pthread_t check_thr, uevent_thr, uxlsnr_thr; | |
149 | pthread_attr_t log_attr, misc_attr; | |
150 | struct vectors * vecs; | |
151 | + struct multipath * mpp; | |
152 | + int i; | |
153 | ||
154 | mlockall(MCL_CURRENT | MCL_FUTURE); | |
155 | ||
156 | @@ -1422,6 +1424,9 @@ child (void * param) | |
157 | */ | |
158 | block_signal(SIGHUP, NULL); | |
159 | lock(vecs->lock); | |
160 | + if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF) | |
161 | + vector_foreach_slot(vecs->mpvec, mpp, i) | |
162 | + dm_queue_if_no_path(mpp->alias, 0); | |
163 | remove_maps_and_stop_waiters(vecs); | |
164 | free_pathvec(vecs->pathvec, FREE_PATHS); | |
165 |