summaryrefslogtreecommitdiffstats
path: root/queue_without_daemon.patch
blob: 209f37ba5ec81fc23ba794e3ccb11477f15ca4ea (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
---
 libmultipath/config.h    |    1 +
 libmultipath/dict.c      |   35 +++++++++++++++++++++++++++++++++++
 libmultipath/structs.h   |    6 ++++++
 multipath.conf.annotated |    9 +++++++++
 multipath.conf.synthetic |    1 +
 multipathd/main.c        |    5 +++++
 6 files changed, 57 insertions(+)

Index: multipath-tools-090724/libmultipath/config.h
===================================================================
--- multipath-tools-090724.orig/libmultipath/config.h
+++ multipath-tools-090724/libmultipath/config.h
@@ -72,6 +72,7 @@ struct config {
 	int pg_timeout;
 	int max_fds;
 	int force_reload;
+	int queue_without_daemon;
 	int daemon;
 	int flush_on_last_del;
 	int attribute_flags;
Index: multipath-tools-090724/libmultipath/dict.c
===================================================================
--- multipath-tools-090724.orig/libmultipath/dict.c
+++ multipath-tools-090724/libmultipath/dict.c
@@ -333,6 +333,28 @@ def_no_path_retry_handler(vector strvec)
 }
 
 static int
+def_queue_without_daemon(vector strvec)
+{
+	char * buff;
+
+	buff = set_value(strvec);
+	if (!buff)
+		return 1;
+
+	if (!strncmp(buff, "off", 3) || !strncmp(buff, "no", 2) ||
+	    !strncmp(buff, "0", 1))
+		conf->queue_without_daemon = QUE_NO_DAEMON_OFF;
+	else if (!strncmp(buff, "on", 2) || !strncmp(buff, "yes", 3) ||
+		 !strncmp(buff, "1", 1))
+		conf->queue_without_daemon = QUE_NO_DAEMON_ON;
+	else
+		conf->queue_without_daemon = QUE_NO_DAEMON_UNDEF;
+
+	free(buff);
+	return 0;
+}
+
+static int
 def_pg_timeout_handler(vector strvec)
 {
 	int pg_timeout;
@@ -1846,6 +1868,18 @@ snprint_def_no_path_retry (char * buff, 
 }
 
 static int
+snprint_def_queue_without_daemon (char * buff, int len, void * data)
+{
+	switch (conf->queue_without_daemon) {
+	case QUE_NO_DAEMON_OFF:
+		return snprintf(buff, len, "no");
+	case QUE_NO_DAEMON_ON:
+		return snprintf(buff, len, "yes");
+	}
+	return 0;
+}
+
+static int
 snprint_def_pg_timeout (char * buff, int len, void * data)
 {
 	if (conf->pg_timeout == DEFAULT_PGTIMEOUT)
@@ -1931,6 +1965,7 @@ init_keywords(void)
 	install_keyword("max_fds", &max_fds_handler, &snprint_max_fds);
 	install_keyword("rr_weight", &def_weight_handler, &snprint_def_rr_weight);
 	install_keyword("no_path_retry", &def_no_path_retry_handler, &snprint_def_no_path_retry);
+	install_keyword("queue_without_daemon", &def_queue_without_daemon, &snprint_def_queue_without_daemon);
 	install_keyword("pg_timeout", &def_pg_timeout_handler, &snprint_def_pg_timeout);
 	install_keyword("flush_on_last_del", &def_flush_on_last_del_handler, &snprint_def_flush_on_last_del);
 	install_keyword("user_friendly_names", &names_handler, &snprint_def_user_friendly_names);
Index: multipath-tools-090724/libmultipath/structs.h
===================================================================
--- multipath-tools-090724.orig/libmultipath/structs.h
+++ multipath-tools-090724/libmultipath/structs.h
@@ -63,6 +63,12 @@ enum pgstates {
 	PGSTATE_ACTIVE
 };
 
+enum queue_without_daemon_states {
+	QUE_NO_DAEMON_UNDEF,
+	QUE_NO_DAEMON_OFF,
+	QUE_NO_DAEMON_ON,
+};
+
 enum pgtimeouts {
 	PGTIMEOUT_UNDEF,
 	PGTIMEOUT_NONE
Index: multipath-tools-090724/multipath.conf.annotated
===================================================================
--- multipath-tools-090724.orig/multipath.conf.annotated
+++ multipath-tools-090724/multipath.conf.annotated
@@ -151,6 +151,15 @@
 #	no_path_retry  queue
 #
 #	#
+#	# name    : queue_without_daemon
+#	# scope   : multipathd
+#	# desc    : If set to "no", multipathd will disable queueing for all
+#	#           devices when it is shut down.
+#	# values  : yes|no
+#	# default : yes
+#	queue_without_daemon	no
+#
+#	#
 #	# name    : user_friendly_names
 #	# scope   : multipath
 #	# desc    : If set to "yes", using the bindings file
Index: multipath-tools-090724/multipath.conf.synthetic
===================================================================
--- multipath-tools-090724.orig/multipath.conf.synthetic
+++ multipath-tools-090724/multipath.conf.synthetic
@@ -16,6 +16,7 @@
 #	rr_weight		priorities
 #	failback		immediate
 #	no_path_retry		fail
+#	queue_without_daemon    no
 #	user_friendly_names	no
 #	mode			644
 #	uid			0
Index: multipath-tools-090724/multipathd/main.c
===================================================================
--- multipath-tools-090724.orig/multipathd/main.c
+++ multipath-tools-090724/multipathd/main.c
@@ -1334,6 +1334,8 @@ child (void * param)
 	pthread_t check_thr, uevent_thr, uxlsnr_thr;
 	pthread_attr_t log_attr, misc_attr;
 	struct vectors * vecs;
+	struct multipath * mpp;
+	int i;
 
 	mlockall(MCL_CURRENT | MCL_FUTURE);
 
@@ -1422,6 +1424,9 @@ child (void * param)
 	 */
 	block_signal(SIGHUP, NULL);
 	lock(vecs->lock);
+	if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF)
+		vector_foreach_slot(vecs->mpvec, mpp, i)
+			dm_queue_if_no_path(mpp->alias, 0);
 	remove_maps_and_stop_waiters(vecs);
 	free_pathvec(vecs->pathvec, FREE_PATHS);