Skip to contentSkip to conversation

multipath-tools ./multipath.conf.annotated ./m ...

PATCH [email protected] 1 participant 1 message Apr 14, 2008 Device mapper

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL4_FC5
Changes by: [email protected] 2008-04-14 22:40:09

Modified files:
. : multipath.conf.annotated
multipath.conf.synthetic
libmultipath : config.c config.h dict.c propsel.c propsel.h
structs.h
multipathd : cli.c cli.h cli_handlers.c cli_handlers.h
main.c

Log message:
Fix for bz #430494. I added another multipath.conf parameter, "flush_on_last_del" that, if set, turns off queueing when the last path for a mutipath device is deleted. It is also possible to disable and restore queueing via multipathd -k commands.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.annotated.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.5&r2=1.16.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.synthetic.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.10.2.2&r2=1.10.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.3&r2=1.17.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.3&r2=1.17.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.16.2.4&r2=1.16.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/propsel.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.9.2.2&r2=1.9.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/propsel.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.4.2.2&r2=1.4.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/structs.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.17.2.7&r2=1.17.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.4&r2=1.4.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.4&r2=1.4.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli_handlers.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.4&r2=1.4.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli_handlers.h.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.2&r2=1.2.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1=1.66.2.3&r2=1.66.2.4

multipath.conf.annotated +30 -0
@@ -140,6 +140,16 @@
 #	no_path_retry  queue
 #
 #	#
+#	# name    : flush_on_last_del
+#	# scope   : multipathd
+#	# desc    : If set to "yes", multipathd will disable queueing when the
+#	#           last path to a device has been deleted.
+#	# values  : yes|no
+#	# default : no
+#	#
+#	flush_on_last_del	yes
+#
+#	#
 #	# name    : user_friendly_names
 #	# scope   : multipath
 #	# desc    : If set to "yes", using the bindings file, by default
@@ -282,7 +292,17 @@
 #		# values  : queue|fail|n (>0)
 #		#
 #		no_path_retry  queue
+#
 #		#
+#		# name    : flush_on_last_del
+#		# scope   : multipathd
+#		# desc    : If set to "yes", multipathd will disable queueing
+#		#           when the last path to a device has been deleted.
+#		# values  : yes|no
+#		# default : no
+#		#
+#		flush_on_last_del	yes
+#
 #		# name    : mode
 #		# scope   : multipath
 #		# desc    : The mode to use for the multipath device node,
@@ -447,6 +467,16 @@
 #		# values  : queue|fail|n (>0)
 #		#
 #		no_path_retry  queue
+#
+#		#
+#		# name    : flush_on_last_del
+#		# scope   : multipathd
+#		# desc    : If set to "yes", multipathd will disable queueing
+#		#           when the last path to a device has been deleted.
+#		# values  : yes|no
+#		# default : no
+#		#
+#		flush_on_last_del	yes
 #	}
 #	device {
 #		vendor			"COMPAQ  "
multipath.conf.synthetic +1 -0
@@ -15,6 +15,7 @@
 #	rr_weight		priorities
 #	failback		immediate
 #	no_path_retry		fail
+#	flush_on_last_del	no
 #	user_friendly_name	yes
 #	mode			0666
 #	uid			0
libmultipath/config.c +1 -0
@@ -408,6 +408,7 @@
 	conf->rr_min_io = DEFAULT_RR_MIN_IO;
 	conf->max_fds = 0;
 	conf->attribute_flags = 0;
+	conf->flush_on_last_del = 0;
 	conf->bindings_file = DEFAULT_BINDINGS_FILE;
 
 	/*
libmultipath/config.h +3 -0
@@ -23,6 +23,7 @@
 	int rr_weight;
 	int no_path_retry;
 	int pg_timeout;
+	int flush_on_last_del;
 
 	char * vendor;
 	char * product;
@@ -44,6 +45,7 @@
 	int no_path_retry;
 	int pg_timeout;
 	int attribute_flags;
+	int flush_on_last_del;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
@@ -75,6 +77,7 @@
 	int pg_timeout;
 	int max_fds;
 	int attribute_flags;
+	int flush_on_last_del;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
libmultipath/dict.c +71 -0

107 lines not on this page · raw message

libmultipath/propsel.c +26 -0
@@ -322,6 +322,32 @@
 }
 
 extern int
+select_flush_on_last_del(struct multipath *mp)
+{
+	if (mp->mpe && mp->mpe->flush_on_last_del != FLUSH_UNDEF) {
+		mp->flush_on_last_del = mp->mpe->flush_on_last_del;
+		condlog(3, "flush_on_last_del = %i (multipath setting)",
+			mp->flush_on_last_del);
+		return 0;
+	}
+	if (mp->hwe && mp->hwe->flush_on_last_del != FLUSH_UNDEF) {
+		mp->flush_on_last_del = mp->hwe->flush_on_last_del;
+		condlog(3, "flush_on_last_del = %i (controler setting)",
+			mp->flush_on_last_del);
+		return 0;
+	}
+	if (conf->flush_on_last_del != FLUSH_UNDEF) {
+		mp->flush_on_last_del = conf->flush_on_last_del;
+		condlog(3, "flush_on_last_del = %i (config file default)",
+			mp->flush_on_last_del);
+		return 0;
+	}
+	mp->flush_on_last_del = FLUSH_UNDEF;
+	condlog(3, "flush_on_last_del = DISABLED (internal default)");
+	return 0;
+}
+
+extern int
 select_pg_timeout(struct multipath *mp)
 {
 	if (mp->mpe && mp->mpe->pg_timeout != PGTIMEOUT_UNDEF) {
libmultipath/propsel.h +1 -0
@@ -14,3 +14,4 @@
 int select_mode(struct multipath *mp);
 int select_uid(struct multipath *mp);
 int select_gid(struct multipath *mp);
+int select_flush_on_last_del(struct multipath *mp);
libmultipath/structs.h +7 -0
@@ -71,6 +71,12 @@
 	ATTR_MODE,
 };
 
+enum flush_states {
+	FLUSH_UNDEF,
+	FLUSH_DISABLED,
+	FLUSH_ENABLED,
+};
+
 struct scsi_idlun {
 	int dev_id;
 	int host_unique_id;
@@ -142,6 +148,7 @@
 	int retry_tick;    /* remaining times for retries */
 	int pg_timeout;
 	int attribute_flags;
+	int flush_on_last_del;
 	uid_t uid;
 	gid_t gid;
 	mode_t mode;
multipathd/cli.c +2 -0
@@ -124,6 +124,8 @@
 	r += add_key(keys, "del", DEL, 0);
 	r += add_key(keys, "switch", SWITCH, 0);
 	r += add_key(keys, "switchgroup", SWITCH, 0);
+	r += add_key(keys, "disablequeueing", DISABLEQ, 0);
+	r += add_key(keys, "restorequeueing", RESTOREQ, 0);
 	r += add_key(keys, "paths", PATHS, 0);
 	r += add_key(keys, "maps", MAPS, 0);
 	r += add_key(keys, "path", PATH, 1);
multipathd/cli.h +4 -0
@@ -3,6 +3,8 @@
 	__ADD,
 	__DEL,
 	__SWITCH,
+	__DISABLEQ,
+	__RESTOREQ,
 	__PATHS,
 	__MAPS,
 	__PATH,
@@ -17,6 +19,8 @@
 #define ADD		(1 << __ADD)
 #define DEL		(1 << __DEL)
 #define SWITCH		(1 << __SWITCH)
+#define DISABLEQ	(1 << __DISABLEQ)
+#define RESTOREQ	(1 << __RESTOREQ)
 #define PATHS		(1 << __PATHS)
 #define MAPS		(1 << __MAPS)
 #define PATH		(1 << __PATH)
multipathd/cli_handlers.c +42 -0

48 lines not on this page · raw message

multipathd/cli_handlers.h +2 -0
@@ -7,3 +7,5 @@
 int cli_switch_group(void * v, char ** reply, int * len, void * data);
 int cli_dump_pathvec(void * v, char ** reply, int * len, void * data);
 int cli_reconfigure(void * v, char ** reply, int * len, void * data);
+int cli_disable_queueing(void * v, char ** reply, int * len, void * data);
+int cli_restore_queueing(void * v, char ** reply, int * len, void * data);
multipathd/main.c +21 -2
@@ -416,6 +416,7 @@
 	adopt_paths(vecs, mpp);
 	mpp->hwe = extract_hwe_from_path(mpp);
 	select_pgfailback(mpp);
+	select_flush_on_last_del(mpp);
 	set_no_path_retry(mpp);
 
 	return 0;
@@ -837,6 +838,8 @@
 {
 	int i;
 	struct path * pp;
+	struct multipath * mpp;
+	int found = 0;
 
 	pp = find_path_by_dev(vecs->pathvec, devname);
 
@@ -844,14 +847,28 @@
 		condlog(3, "%s: not in pathvec", devname);
 		return 1;
 	}
+	
+	mpp = pp->mpp;
 
-	if (pp->mpp && (pp->state == PATH_UP || pp->state == PATH_GHOST))
-		update_queue_mode_del_path(pp->mpp);
+	if (mpp && (pp->state == PATH_UP || pp->state == PATH_GHOST))
+		update_queue_mode_del_path(mpp);
 
 	condlog(2, "remove %s path checker", devname);
 	i = find_slot(vecs->pathvec, (void *)pp);
 	vector_del_slot(vecs->pathvec, i);
 	free_path(pp);
+	vector_foreach_slot (vecs->pathvec, pp, i) {
+		if (pp->mpp == mpp){
+			found = 1;
+			break;
+		}
+	}
+	if (!found && mpp->flush_on_last_del == FLUSH_ENABLED) {	
+		condlog(1, "%s: Last path deleted, disabling queueing",
+		        mpp->alias);
+		mpp->retry_tick = 0;
+		dm_queue_if_no_path(mpp->alias, 0);
+	}
 
 	return 0;
 }
@@ -1166,6 +1183,8 @@
 	add_handler(SWITCH+MAP+GROUP, cli_switch_group);
 	add_handler(DUMP+PATHVEC, cli_dump_pathvec);
 	add_handler(RECONFIGURE, cli_reconfigure);
+	add_handler(DISABLEQ+MAP, cli_disable_queueing);
+	add_handler(RESTOREQ+MAP, cli_restore_queueing);
 
 	uxsock_listen(&uxsock_trigger, ap);