basebuilder_pel7x64builder0
6 years ago
14 changed files with 3156 additions and 1 deletions
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
--- |
||||
multipath/main.c | 9 ++++++--- |
||||
1 file changed, 6 insertions(+), 3 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/multipath/main.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipath/main.c |
||||
+++ multipath-tools-130222/multipath/main.c |
||||
@@ -135,7 +135,7 @@ usage (char * progname) |
||||
} |
||||
|
||||
static int |
||||
-update_paths (struct multipath * mpp) |
||||
+update_paths (struct multipath * mpp, int quick) |
||||
{ |
||||
int i, j; |
||||
struct pathgroup * pgp; |
||||
@@ -149,6 +149,10 @@ update_paths (struct multipath * mpp) |
||||
continue; |
||||
|
||||
vector_foreach_slot (pgp->paths, pp, j) { |
||||
+ if (quick) { |
||||
+ pp->mpp = mpp; |
||||
+ continue; |
||||
+ } |
||||
if (!strlen(pp->dev)) { |
||||
if (devt2devname(pp->dev, FILE_NAME_SIZE, |
||||
pp->dev_t)) { |
||||
@@ -213,8 +217,7 @@ get_dm_mpvec (vector curmp, vector pathv |
||||
* If not in "fast list mode", we need to fetch information |
||||
* about them |
||||
*/ |
||||
- if (conf->cmd != CMD_LIST_SHORT) |
||||
- update_paths(mpp); |
||||
+ update_paths(mpp, (conf->cmd == CMD_LIST_SHORT)); |
||||
|
||||
if (conf->cmd == CMD_LIST_LONG) |
||||
mpp->bestpg = select_path_group(mpp); |
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
--- |
||||
libmultipath/config.c | 3 ++- |
||||
multipath/mpathconf.8 | 8 ++++++-- |
||||
2 files changed, 8 insertions(+), 3 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/config.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/config.c |
||||
+++ multipath-tools-130222/libmultipath/config.c |
||||
@@ -739,7 +739,8 @@ load_config (char * file, struct udev *u |
||||
condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices."); |
||||
condlog(0, "A default multipath.conf file is located at"); |
||||
condlog(0, "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", MULTIPATH_VERSION(VERSION_CODE)); |
||||
- condlog(0, "You can run /sbin/mpathconf to create or modify /etc/multipath.conf"); |
||||
+ condlog(0, "You can run /sbin/mpathconf --enable to create"); |
||||
+ condlog(0, "/etc/multipath.conf. See man mpathconf(8) for more details"); |
||||
if (conf->blist_devnode == NULL) { |
||||
conf->blist_devnode = vector_alloc(); |
||||
if (!conf->blist_devnode) { |
||||
Index: multipath-tools-130222/multipath/mpathconf.8 |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipath/mpathconf.8 |
||||
+++ multipath-tools-130222/multipath/mpathconf.8 |
||||
@@ -19,7 +19,9 @@ daemon, and configure the |
||||
.B multipathd |
||||
service to start automatically or not. If |
||||
.B mpathconf |
||||
-is called with no commands, it will display the current configuration. |
||||
+is called with no commands, it will display the current configuration, but |
||||
+will not create or modify |
||||
+.B /etc/multipath.conf |
||||
|
||||
The default options for mpathconf are |
||||
.B --with_module |
||||
@@ -50,7 +52,9 @@ command. |
||||
.B --enable |
||||
Removes any line that blacklists all device nodes from the |
||||
.B /etc/multipath.conf |
||||
-blacklist section. |
||||
+blacklist section. Also, creates |
||||
+.B /etc/multipath.conf |
||||
+if it doesn't exist. |
||||
.TP |
||||
.B --disable |
||||
Adds a line that blacklists all device nodes to the |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
--- |
||||
libmpathcmd/mpath_cmd.h | 2 +- |
||||
1 file changed, 1 insertion(+), 1 deletion(-) |
||||
|
||||
Index: multipath-tools-130222/libmpathcmd/mpath_cmd.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmpathcmd/mpath_cmd.h |
||||
+++ multipath-tools-130222/libmpathcmd/mpath_cmd.h |
||||
@@ -27,7 +27,7 @@ extern "C" { |
||||
#endif |
||||
|
||||
#define DEFAULT_SOCKET "/org/kernel/linux/storage/multipathd" |
||||
-#define DEFAULT_REPLY_TIMEOUT 10000 |
||||
+#define DEFAULT_REPLY_TIMEOUT 60000 |
||||
|
||||
|
||||
/* |
@ -0,0 +1,82 @@
@@ -0,0 +1,82 @@
|
||||
--- |
||||
libmultipath/discovery.c | 12 ++++++------ |
||||
libmultipath/structs.h | 11 +++++++++-- |
||||
2 files changed, 15 insertions(+), 8 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/discovery.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c |
||||
+++ multipath-tools-130222/libmultipath/discovery.c |
||||
@@ -845,12 +845,12 @@ scsi_sysfs_pathinfo (struct path * pp) |
||||
|
||||
condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); |
||||
|
||||
- if (sysfs_get_model(parent, pp->product_id, SCSI_PRODUCT_SIZE)) |
||||
+ if (sysfs_get_model(parent, pp->product_id, PATH_PRODUCT_SIZE)) |
||||
return 1; |
||||
|
||||
condlog(3, "%s: product = %s", pp->dev, pp->product_id); |
||||
|
||||
- if (sysfs_get_rev(parent, pp->rev, SCSI_REV_SIZE)) |
||||
+ if (sysfs_get_rev(parent, pp->rev, PATH_REV_SIZE)) |
||||
return 1; |
||||
|
||||
condlog(3, "%s: rev = %s", pp->dev, pp->rev); |
||||
@@ -904,11 +904,11 @@ nvme_sysfs_pathinfo (struct path * pp) |
||||
return 1; |
||||
|
||||
snprintf(pp->vendor_id, SCSI_VENDOR_SIZE, "NVME"); |
||||
- snprintf(pp->product_id, SCSI_PRODUCT_SIZE, "%s", |
||||
+ snprintf(pp->product_id, PATH_PRODUCT_SIZE, "%s", |
||||
udev_device_get_sysattr_value(parent, "model")); |
||||
snprintf(pp->serial, SERIAL_SIZE, "%s", |
||||
udev_device_get_sysattr_value(parent, "serial")); |
||||
- snprintf(pp->rev, SCSI_REV_SIZE, "%s", |
||||
+ snprintf(pp->rev, PATH_REV_SIZE, "%s", |
||||
udev_device_get_sysattr_value(parent, "firmware_rev")); |
||||
|
||||
condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); |
||||
@@ -1022,12 +1022,12 @@ cciss_sysfs_pathinfo (struct path * pp) |
||||
|
||||
condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); |
||||
|
||||
- if (sysfs_get_model(parent, pp->product_id, SCSI_PRODUCT_SIZE)) |
||||
+ if (sysfs_get_model(parent, pp->product_id, PATH_PRODUCT_SIZE)) |
||||
return 1; |
||||
|
||||
condlog(3, "%s: product = %s", pp->dev, pp->product_id); |
||||
|
||||
- if (sysfs_get_rev(parent, pp->rev, SCSI_REV_SIZE)) |
||||
+ if (sysfs_get_rev(parent, pp->rev, PATH_REV_SIZE)) |
||||
return 1; |
||||
|
||||
condlog(3, "%s: rev = %s", pp->dev, pp->rev); |
||||
Index: multipath-tools-130222/libmultipath/structs.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/structs.h |
||||
+++ multipath-tools-130222/libmultipath/structs.h |
||||
@@ -24,6 +24,13 @@ |
||||
#define SCSI_PRODUCT_SIZE 17 |
||||
#define SCSI_REV_SIZE 5 |
||||
#define SCSI_STATE_SIZE 19 |
||||
+#define NVME_MODEL_SIZE 41 |
||||
+#define NVME_REV_SIZE 9 |
||||
+ |
||||
+/* This must be the maximum of SCSI and NVME sizes */ |
||||
+#define PATH_PRODUCT_SIZE NVME_MODEL_SIZE |
||||
+#define PATH_REV_SIZE NVME_REV_SIZE |
||||
+ |
||||
|
||||
#define NO_PATH_RETRY_UNDEF 0 |
||||
#define NO_PATH_RETRY_FAIL -1 |
||||
@@ -212,8 +219,8 @@ struct path { |
||||
struct hd_geometry geom; |
||||
char wwid[WWID_SIZE]; |
||||
char vendor_id[SCSI_VENDOR_SIZE]; |
||||
- char product_id[SCSI_PRODUCT_SIZE]; |
||||
- char rev[SCSI_REV_SIZE]; |
||||
+ char product_id[PATH_PRODUCT_SIZE]; |
||||
+ char rev[PATH_REV_SIZE]; |
||||
char serial[SERIAL_SIZE]; |
||||
char tgt_node_name[NODE_NAME_SIZE]; |
||||
unsigned long long size; |
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
--- |
||||
libmultipath/print.c | 7 +++++++ |
||||
1 file changed, 7 insertions(+) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/print.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/print.c |
||||
+++ multipath-tools-130222/libmultipath/print.c |
||||
@@ -601,6 +601,12 @@ snprint_path_checker (char * buff, size_ |
||||
return snprint_str(buff, len, c->name); |
||||
} |
||||
|
||||
+static int |
||||
+snprint_path_failures(char * buff, size_t len, struct path * pp) |
||||
+{ |
||||
+ return snprint_int(buff, len, pp->failcount); |
||||
+} |
||||
+ |
||||
struct multipath_data mpd[] = { |
||||
{'n', "name", 0, snprint_name}, |
||||
{'w', "uuid", 0, snprint_multipath_uuid}, |
||||
@@ -647,6 +653,7 @@ struct path_data pd[] = { |
||||
{'R', "host WWPN", 0, snprint_host_wwpn}, |
||||
{'r', "target WWPN", 0, snprint_tgt_wwpn}, |
||||
{'a', "host adapter", 0, snprint_host_adapter}, |
||||
+ {'0', "failures", 0, snprint_path_failures}, |
||||
{0, NULL, 0 , NULL} |
||||
}; |
||||
|
@ -0,0 +1,385 @@
@@ -0,0 +1,385 @@
|
||||
--- |
||||
libmpathpersist/mpath_persist.c | 28 +++++++++++--- |
||||
libmultipath/config.c | 3 + |
||||
libmultipath/config.h | 2 + |
||||
libmultipath/defaults.h | 1 |
||||
libmultipath/dict.c | 77 ++++++++++++++++++++++++++++++++++++++++ |
||||
libmultipath/propsel.c | 20 ++++++++++ |
||||
libmultipath/propsel.h | 1 |
||||
libmultipath/structs.h | 7 +++ |
||||
multipath/multipath.conf.5 | 7 +++ |
||||
9 files changed, 140 insertions(+), 6 deletions(-) |
||||
|
||||
Index: multipath-tools-130222-patched/libmpathpersist/mpath_persist.c |
||||
=================================================================== |
||||
--- multipath-tools-130222-patched.orig/libmpathpersist/mpath_persist.c |
||||
+++ multipath-tools-130222-patched/libmpathpersist/mpath_persist.c |
||||
@@ -287,6 +287,7 @@ int mpath_persistent_reserve_out ( int f |
||||
} |
||||
|
||||
select_reservation_key(mpp); |
||||
+ select_all_tg_pt(mpp); |
||||
|
||||
memcpy(&prkey, paramp->sa_key, 8); |
||||
if (mpp->prkey_source == PRKEY_SOURCE_FILE && prkey && |
||||
@@ -419,7 +420,7 @@ int mpath_prout_reg(struct multipath *mp |
||||
unsigned int rq_type, struct prout_param_descriptor * paramp, int noisy) |
||||
{ |
||||
|
||||
- int i, j; |
||||
+ int i, j, k; |
||||
struct pathgroup *pgp = NULL; |
||||
struct path *pp = NULL; |
||||
int rollback = 0; |
||||
@@ -444,11 +445,13 @@ int mpath_prout_reg(struct multipath *mp |
||||
} |
||||
|
||||
struct threadinfo thread[active_pathcount]; |
||||
+ int hosts[active_pathcount]; |
||||
|
||||
memset(thread, 0, sizeof(thread)); |
||||
|
||||
/* init thread parameter */ |
||||
for (i =0; i< active_pathcount; i++){ |
||||
+ hosts[i] = -1; |
||||
thread[i].param.rq_servact = rq_servact; |
||||
thread[i].param.rq_scope = rq_scope; |
||||
thread[i].param.rq_type = rq_type; |
||||
@@ -476,6 +479,17 @@ int mpath_prout_reg(struct multipath *mp |
||||
condlog (1, "%s: %s path not up. Skip.", mpp->wwid, pp->dev); |
||||
continue; |
||||
} |
||||
+ if (mpp->all_tg_pt == ALL_TG_PT_ON && |
||||
+ pp->sg_id.host_no != -1) { |
||||
+ for (k = 0; k < count; k++) { |
||||
+ if (pp->sg_id.host_no == hosts[k]) { |
||||
+ condlog(3, "%s: %s host %d matches skip.", pp->wwid, pp->dev, pp->sg_id.host_no); |
||||
+ break; |
||||
+ } |
||||
+ } |
||||
+ if (k < count) |
||||
+ continue; |
||||
+ } |
||||
strncpy(thread[count].param.dev, pp->dev, FILE_NAME_SIZE); |
||||
|
||||
if (count && (thread[count].param.paramp->sa_flags & MPATH_F_SPEC_I_PT_MASK)){ |
||||
@@ -492,10 +506,12 @@ int mpath_prout_reg(struct multipath *mp |
||||
condlog (0, "%s: failed to create thread %d", mpp->wwid, rc); |
||||
thread[count].param.status = MPATH_PR_THREAD_ERROR; |
||||
} |
||||
+ else |
||||
+ hosts[count] = pp->sg_id.host_no; |
||||
count = count +1; |
||||
} |
||||
} |
||||
- for( i=0; i < active_pathcount ; i++){ |
||||
+ for( i=0; i < count ; i++){ |
||||
if (thread[i].param.status != MPATH_PR_THREAD_ERROR) { |
||||
rc = pthread_join(thread[i].id, NULL); |
||||
if (rc){ |
||||
@@ -518,7 +534,7 @@ int mpath_prout_reg(struct multipath *mp |
||||
} |
||||
if (rollback && ((rq_servact == MPATH_PROUT_REG_SA) && sa_key != 0 )){ |
||||
condlog (3, "%s: ERROR: initiating pr out rollback", mpp->wwid); |
||||
- for( i=0 ; i < active_pathcount ; i++){ |
||||
+ for( i=0 ; i < count ; i++){ |
||||
if (thread[i].param.status == MPATH_PR_SUCCESS) { |
||||
memcpy(&thread[i].param.paramp->key, &thread[i].param.paramp->sa_key, 8); |
||||
memset(&thread[i].param.paramp->sa_key, 0, 8); |
||||
@@ -532,7 +548,7 @@ int mpath_prout_reg(struct multipath *mp |
||||
} else |
||||
thread[i].param.status = MPATH_PR_SKIP; |
||||
} |
||||
- for(i=0; i < active_pathcount ; i++){ |
||||
+ for(i=0; i < count ; i++){ |
||||
if (thread[i].param.status != MPATH_PR_SKIP && |
||||
thread[i].param.status != MPATH_PR_THREAD_ERROR) { |
||||
rc = pthread_join(thread[i].id, NULL); |
||||
@@ -678,7 +694,7 @@ int mpath_prout_rel(struct multipath *mp |
||||
} |
||||
} |
||||
pthread_attr_destroy (&attr); |
||||
- for (i = 0; i < active_pathcount; i++){ |
||||
+ for (i = 0; i < count; i++){ |
||||
if (thread[i].param.status != MPATH_PR_THREAD_ERROR) { |
||||
rc = pthread_join (thread[i].id, NULL); |
||||
if (rc){ |
||||
@@ -687,7 +703,7 @@ int mpath_prout_rel(struct multipath *mp |
||||
} |
||||
} |
||||
|
||||
- for (i = 0; i < active_pathcount; i++){ |
||||
+ for (i = 0; i < count; i++){ |
||||
/* check thread status here and return the status */ |
||||
|
||||
if (thread[i].param.status == MPATH_PR_RESERV_CONFLICT) |
||||
Index: multipath-tools-130222-patched/libmultipath/config.c |
||||
=================================================================== |
||||
--- multipath-tools-130222-patched.orig/libmultipath/config.c |
||||
+++ multipath-tools-130222-patched/libmultipath/config.c |
||||
@@ -349,6 +349,7 @@ merge_hwe (struct hwentry * dst, struct |
||||
merge_num(max_sectors_kb); |
||||
merge_num(unpriv_sgio); |
||||
merge_num(ghost_delay); |
||||
+ merge_num(all_tg_pt); |
||||
|
||||
/* |
||||
* Make sure features is consistent with |
||||
@@ -414,6 +415,7 @@ overwrite_hwe (struct hwentry * dst, str |
||||
overwrite_num(max_sectors_kb); |
||||
overwrite_num(unpriv_sgio); |
||||
overwrite_num(ghost_delay); |
||||
+ overwrite_num(all_tg_pt); |
||||
|
||||
/* |
||||
* Make sure features is consistent with |
||||
@@ -700,6 +702,7 @@ load_config (char * file, struct udev *u |
||||
conf->max_sectors_kb = DEFAULT_MAX_SECTORS_KB; |
||||
conf->unpriv_sgio = DEFAULT_UNPRIV_SGIO; |
||||
conf->ghost_delay = DEFAULT_GHOST_DELAY; |
||||
+ conf->all_tg_pt = DEFAULT_ALL_TG_PT; |
||||
|
||||
/* |
||||
* preload default hwtable |
||||
Index: multipath-tools-130222-patched/libmultipath/config.h |
||||
=================================================================== |
||||
--- multipath-tools-130222-patched.orig/libmultipath/config.h |
||||
+++ multipath-tools-130222-patched/libmultipath/config.h |
||||
@@ -71,6 +71,7 @@ struct hwentry { |
||||
int max_sectors_kb; |
||||
int unpriv_sgio; |
||||
int ghost_delay; |
||||
+ int all_tg_pt; |
||||
char * bl_product; |
||||
}; |
||||
|
||||
@@ -162,6 +163,7 @@ struct config { |
||||
int max_sectors_kb; |
||||
int unpriv_sgio; |
||||
int ghost_delay; |
||||
+ int all_tg_pt; |
||||
unsigned int version[3]; |
||||
|
||||
char * dev; |
||||
Index: multipath-tools-130222-patched/libmultipath/dict.c |
||||
=================================================================== |
||||
--- multipath-tools-130222-patched.orig/libmultipath/dict.c |
||||
+++ multipath-tools-130222-patched/libmultipath/dict.c |
||||
@@ -1051,6 +1051,29 @@ def_ghost_delay_handler(vector strvec) |
||||
return 0; |
||||
} |
||||
|
||||
+static int |
||||
+def_all_tg_pt_handler(vector strvec) |
||||
+{ |
||||
+ char * buff; |
||||
+ |
||||
+ buff = set_value(strvec); |
||||
+ if (!buff) |
||||
+ return 1; |
||||
+ |
||||
+ if ((strlen(buff) == 2 && !strcmp(buff, "no")) || |
||||
+ (strlen(buff) == 1 && !strcmp(buff, "0"))) |
||||
+ conf->all_tg_pt = ALL_TG_PT_OFF; |
||||
+ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) || |
||||
+ (strlen(buff) == 1 && !strcmp(buff, "1"))) |
||||
+ conf->all_tg_pt = ALL_TG_PT_ON; |
||||
+ else |
||||
+ conf->all_tg_pt = DEFAULT_ALL_TG_PT; |
||||
+ |
||||
+ FREE(buff); |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
+ |
||||
/* |
||||
* blacklist block handlers |
||||
*/ |
||||
@@ -1969,6 +1992,33 @@ hw_ghost_delay_handler(vector strvec) |
||||
return 0; |
||||
} |
||||
|
||||
+static int |
||||
+hw_all_tg_pt_handler(vector strvec) |
||||
+{ |
||||
+ struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable); |
||||
+ char * buff; |
||||
+ |
||||
+ if (!hwe) |
||||
+ return 1; |
||||
+ |
||||
+ buff = set_value(strvec); |
||||
+ |
||||
+ if (!buff) |
||||
+ return 1; |
||||
+ |
||||
+ if ((strlen(buff) == 2 && !strcmp(buff, "no")) || |
||||
+ (strlen(buff) == 1 && !strcmp(buff, "0"))) |
||||
+ hwe->all_tg_pt = ALL_TG_PT_OFF; |
||||
+ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) || |
||||
+ (strlen(buff) == 1 && !strcmp(buff, "1"))) |
||||
+ hwe->all_tg_pt = ALL_TG_PT_ON; |
||||
+ else |
||||
+ hwe->all_tg_pt = ALL_TG_PT_UNDEF; |
||||
+ |
||||
+ FREE(buff); |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
/* |
||||
* multipaths block handlers |
||||
*/ |
||||
@@ -3325,6 +3375,19 @@ snprint_hw_ghost_delay (char * buff, int |
||||
} |
||||
|
||||
static int |
||||
+snprint_hw_all_tg_pt(char * buff, int len, void * data) |
||||
+{ |
||||
+ struct hwentry * hwe = (struct hwentry *)data; |
||||
+ |
||||
+ if (hwe->all_tg_pt == ALL_TG_PT_ON) |
||||
+ return snprintf(buff, len, "yes"); |
||||
+ else if (hwe->all_tg_pt == ALL_TG_PT_OFF) |
||||
+ return snprintf(buff, len, "no"); |
||||
+ else |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
+static int |
||||
snprint_def_polling_interval (char * buff, int len, void * data) |
||||
{ |
||||
return snprintf(buff, len, "%i", conf->checkint); |
||||
@@ -3829,6 +3892,15 @@ snprint_def_ghost_delay (char * buff, in |
||||
} |
||||
|
||||
static int |
||||
+snprint_def_all_tg_pt(char * buff, int len, void * data) |
||||
+{ |
||||
+ if (conf->all_tg_pt == ALL_TG_PT_ON) |
||||
+ return snprintf(buff, len, "yes"); |
||||
+ else |
||||
+ return snprintf(buff, len, "no"); |
||||
+} |
||||
+ |
||||
+static int |
||||
snprint_ble_simple (char * buff, int len, void * data) |
||||
{ |
||||
struct blentry * ble = (struct blentry *)data; |
||||
@@ -3926,6 +3998,7 @@ init_keywords(void) |
||||
install_keyword("max_sectors_kb", &def_max_sectors_kb_handler, &snprint_def_max_sectors_kb); |
||||
install_keyword("unpriv_sgio", &def_unpriv_sgio_handler, &snprint_def_unpriv_sgio); |
||||
install_keyword("ghost_delay", &def_ghost_delay_handler, &snprint_def_ghost_delay); |
||||
+ install_keyword("all_tg_pt", &def_all_tg_pt_handler, &snprint_def_all_tg_pt); |
||||
__deprecated install_keyword("default_selector", &def_selector_handler, NULL); |
||||
__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); |
||||
__deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL); |
||||
@@ -4000,6 +4073,7 @@ init_keywords(void) |
||||
install_keyword("max_sectors_kb", &hw_max_sectors_kb_handler, &snprint_hw_max_sectors_kb); |
||||
install_keyword("unpriv_sgio", &hw_unpriv_sgio_handler, &snprint_hw_unpriv_sgio); |
||||
install_keyword("ghost_delay", &hw_ghost_delay_handler, &snprint_hw_ghost_delay); |
||||
+ install_keyword("all_tg_pt", &hw_all_tg_pt_handler, &snprint_hw_all_tg_pt); |
||||
install_sublevel_end(); |
||||
|
||||
install_keyword_root("overrides", &nop_handler); |
||||
@@ -4031,6 +4105,9 @@ init_keywords(void) |
||||
install_keyword("delay_wait_checks", &nop_handler, &snprint_nop); |
||||
install_keyword("skip_kpartx", &nop_handler, &snprint_nop); |
||||
install_keyword("max_sectors_kb", &nop_handler, &snprint_nop); |
||||
+ install_keyword("unpriv_sgio", &nop_handler, &snprint_nop); |
||||
+ install_keyword("ghost_delay", &nop_handler, &snprint_nop); |
||||
+ install_keyword("all_tg_pt", &nop_handler, &snprint_nop); |
||||
|
||||
install_keyword_root("multipaths", &multipaths_handler); |
||||
install_keyword_multi("multipath", &multipath_handler, NULL); |
||||
Index: multipath-tools-130222-patched/libmultipath/propsel.c |
||||
=================================================================== |
||||
--- multipath-tools-130222-patched.orig/libmultipath/propsel.c |
||||
+++ multipath-tools-130222-patched/libmultipath/propsel.c |
||||
@@ -992,3 +992,23 @@ select_ghost_delay (struct multipath * m |
||||
condlog(3, "ghost_delay = DISABLED (internal default)"); |
||||
return 0; |
||||
} |
||||
+ |
||||
+extern int |
||||
+select_all_tg_pt (struct multipath *mp) |
||||
+{ |
||||
+ if (mp->hwe && mp->hwe->all_tg_pt != ALL_TG_PT_UNDEF) { |
||||
+ mp->all_tg_pt = mp->hwe->all_tg_pt; |
||||
+ condlog(3, "all_tg_pt = %i (controller setting)", |
||||
+ mp->all_tg_pt); |
||||
+ return 0; |
||||
+ } |
||||
+ if (conf->all_tg_pt != GHOST_DELAY_UNDEF) { |
||||
+ mp->all_tg_pt = conf->all_tg_pt; |
||||
+ condlog(3, "all_tg_pt = %i (config file default)", |
||||
+ mp->all_tg_pt); |
||||
+ return 0; |
||||
+ } |
||||
+ mp->all_tg_pt = DEFAULT_ALL_TG_PT; |
||||
+ condlog(3, "all_tg_pt = %i (internal default)", mp->all_tg_pt); |
||||
+ return 0; |
||||
+} |
||||
Index: multipath-tools-130222-patched/libmultipath/structs.h |
||||
=================================================================== |
||||
--- multipath-tools-130222-patched.orig/libmultipath/structs.h |
||||
+++ multipath-tools-130222-patched/libmultipath/structs.h |
||||
@@ -154,6 +154,12 @@ enum unpriv_sgio_states { |
||||
UNPRIV_SGIO_ON, |
||||
}; |
||||
|
||||
+enum all_tg_pt_states { |
||||
+ ALL_TG_PT_UNDEF, |
||||
+ ALL_TG_PT_OFF, |
||||
+ ALL_TG_PT_ON, |
||||
+}; |
||||
+ |
||||
enum scsi_protocol { |
||||
SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */ |
||||
SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */ |
||||
@@ -324,6 +330,7 @@ struct multipath { |
||||
int prkey_source; |
||||
struct be64 reservation_key; |
||||
unsigned char prflag; |
||||
+ int all_tg_pt; |
||||
}; |
||||
|
||||
struct pathgroup { |
||||
Index: multipath-tools-130222-patched/libmultipath/propsel.h |
||||
=================================================================== |
||||
--- multipath-tools-130222-patched.orig/libmultipath/propsel.h |
||||
+++ multipath-tools-130222-patched/libmultipath/propsel.h |
||||
@@ -28,3 +28,4 @@ int select_skip_kpartx (struct multipath |
||||
int select_max_sectors_kb (struct multipath * mp); |
||||
int select_unpriv_sgio (struct multipath * mp); |
||||
int select_ghost_delay (struct multipath * mp); |
||||
+int select_all_tg_pt (struct multipath *mp); |
||||
Index: multipath-tools-130222-patched/libmultipath/defaults.h |
||||
=================================================================== |
||||
--- multipath-tools-130222-patched.orig/libmultipath/defaults.h |
||||
+++ multipath-tools-130222-patched/libmultipath/defaults.h |
||||
@@ -29,6 +29,7 @@ |
||||
#define DEFAULT_MAX_SECTORS_KB MAX_SECTORS_KB_UNDEF |
||||
#define DEFAULT_UNPRIV_SGIO UNPRIV_SGIO_OFF |
||||
#define DEFAULT_GHOST_DELAY GHOST_DELAY_OFF |
||||
+#define DEFAULT_ALL_TG_PT ALL_TG_PT_OFF |
||||
|
||||
#define DEFAULT_CHECKINT 5 |
||||
#define MAX_CHECKINT(a) (a << 2) |
||||
Index: multipath-tools-130222-patched/multipath/multipath.conf.5 |
||||
=================================================================== |
||||
--- multipath-tools-130222-patched.orig/multipath/multipath.conf.5 |
||||
+++ multipath-tools-130222-patched/multipath/multipath.conf.5 |
||||
@@ -449,6 +449,13 @@ registration is removed, the RESERVATION |
||||
It is unset by default. |
||||
.RE |
||||
.TP |
||||
+.B all_tg_pt |
||||
+This must be set to \fIyes\fR to successfully use mpathpersist on arrays that |
||||
+automatically set and clear registration keys on all target ports from a |
||||
+host, instead of per target port per host. |
||||
+Default is |
||||
+.I no |
||||
+.TP |
||||
.B retain_attached_hw_handler |
||||
If set to |
||||
.I yes |
@ -0,0 +1,504 @@
@@ -0,0 +1,504 @@
|
||||
--- |
||||
libmpathpersist/mpath_persist.c | 3 ++- |
||||
libmpathpersist/mpath_updatepr.c | 10 ++++++++-- |
||||
libmpathpersist/mpathpr.h | 3 ++- |
||||
libmultipath/Makefile | 2 +- |
||||
libmultipath/config.h | 2 ++ |
||||
libmultipath/dict.c | 24 ++++++++++++++++++------ |
||||
libmultipath/prkey.c | 25 ++++++++++++++++++++++--- |
||||
libmultipath/prkey.h | 4 ++-- |
||||
libmultipath/propsel.c | 13 ++++++++++--- |
||||
libmultipath/structs.h | 1 + |
||||
libmultipath/util.c | 16 ++++++++++++++++ |
||||
libmultipath/util.h | 1 + |
||||
multipath/multipath.conf.5 | 8 ++++++-- |
||||
multipathd/cli_handlers.c | 15 ++++++++++----- |
||||
multipathd/main.c | 1 + |
||||
15 files changed, 102 insertions(+), 26 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/config.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/config.h |
||||
+++ multipath-tools-130222/libmultipath/config.h |
||||
@@ -86,6 +86,7 @@ struct mpentry { |
||||
char * prio_args; |
||||
int prkey_source; |
||||
struct be64 reservation_key; |
||||
+ uint8_t sa_flags; |
||||
int pgpolicy; |
||||
int pgfailback; |
||||
int rr_weight; |
||||
@@ -183,6 +184,7 @@ struct config { |
||||
char * config_dir; |
||||
int prkey_source; |
||||
struct be64 reservation_key; |
||||
+ uint8_t sa_flags; |
||||
|
||||
vector keywords; |
||||
vector mptable; |
||||
Index: multipath-tools-130222/libmultipath/structs.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/structs.h |
||||
+++ multipath-tools-130222/libmultipath/structs.h |
||||
@@ -331,6 +331,7 @@ struct multipath { |
||||
struct be64 reservation_key; |
||||
unsigned char prflag; |
||||
int all_tg_pt; |
||||
+ uint8_t sa_flags; |
||||
}; |
||||
|
||||
struct pathgroup { |
||||
Index: multipath-tools-130222/libmultipath/util.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/util.c |
||||
+++ multipath-tools-130222/libmultipath/util.c |
||||
@@ -6,6 +6,8 @@ |
||||
#include <sys/vfs.h> |
||||
#include <linux/magic.h> |
||||
#include <errno.h> |
||||
+#include <libudev.h> |
||||
+#include <mpath_persist.h> |
||||
|
||||
#include "debug.h" |
||||
#include "memory.h" |
||||
@@ -317,6 +319,20 @@ int parse_prkey(char *ptr, uint64_t *prk |
||||
return 0; |
||||
} |
||||
|
||||
+int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags) |
||||
+{ |
||||
+ char *flagstr; |
||||
+ |
||||
+ flagstr = strchr(ptr, ':'); |
||||
+ *flags = 0; |
||||
+ if (flagstr) { |
||||
+ *flagstr++ = '\0'; |
||||
+ if (strlen(flagstr) == 5 && strcmp(flagstr, "aptpl") == 0) |
||||
+ *flags = MPATH_F_APTPL_MASK; |
||||
+ } |
||||
+ return parse_prkey(ptr, prkey); |
||||
+} |
||||
+ |
||||
int safe_write(int fd, const void *buf, size_t count) |
||||
{ |
||||
while (count > 0) { |
||||
Index: multipath-tools-130222/libmultipath/util.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/util.h |
||||
+++ multipath-tools-130222/libmultipath/util.h |
||||
@@ -15,6 +15,7 @@ dev_t parse_devt(const char *dev_t); |
||||
char *convert_dev(char *dev, int is_path_device); |
||||
int in_initrd(void); |
||||
int parse_prkey(char *ptr, uint64_t *prkey); |
||||
+int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags); |
||||
int safe_write(int fd, const void *buf, size_t count); |
||||
|
||||
#define safe_sprintf(var, format, args...) \ |
||||
Index: multipath-tools-130222/libmultipath/Makefile |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/Makefile |
||||
+++ multipath-tools-130222/libmultipath/Makefile |
||||
@@ -8,7 +8,7 @@ SONAME=0 |
||||
DEVLIB = libmultipath.so |
||||
LIBS = $(DEVLIB).$(SONAME) |
||||
LIBDEPS = -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd |
||||
-CFLAGS += -fPIC -I$(mpathcmddir) |
||||
+CFLAGS += -fPIC -I$(mpathcmddir) -I$(mpathpersistdir) |
||||
|
||||
OBJS = memory.o parser.o vector.o devmapper.o \ |
||||
hwtable.o blacklist.o util.o dmparser.o config.o \ |
||||
Index: multipath-tools-130222/libmultipath/dict.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/dict.c |
||||
+++ multipath-tools-130222/libmultipath/dict.c |
||||
@@ -23,6 +23,8 @@ |
||||
#include "util.h" |
||||
#include "prkey.h" |
||||
#include <inttypes.h> |
||||
+#include <libudev.h> |
||||
+#include <mpath_persist.h> |
||||
|
||||
/* |
||||
* default block handlers |
||||
@@ -557,6 +559,7 @@ def_reservation_key_handler(vector strve |
||||
{ |
||||
char *buff; |
||||
uint64_t prkey = 0; |
||||
+ uint8_t flags; |
||||
|
||||
buff = set_value(strvec); |
||||
if (!buff) |
||||
@@ -568,12 +571,13 @@ def_reservation_key_handler(vector strve |
||||
FREE(buff); |
||||
return 0; |
||||
} |
||||
- else if (parse_prkey(buff, &prkey) != 0) { |
||||
+ else if (parse_prkey_flags(buff, &prkey, &flags) != 0) { |
||||
FREE(buff); |
||||
return 1; |
||||
} |
||||
|
||||
conf->prkey_source = PRKEY_SOURCE_CONF; |
||||
+ conf->sa_flags = flags; |
||||
put_be64(conf->reservation_key, prkey); |
||||
FREE(buff); |
||||
return 0; |
||||
@@ -2403,6 +2407,7 @@ mp_reservation_key_handler (vector strve |
||||
char *buff; |
||||
struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable); |
||||
uint64_t prkey; |
||||
+ uint8_t flags; |
||||
|
||||
if (!mpe) |
||||
return 1; |
||||
@@ -2417,12 +2422,13 @@ mp_reservation_key_handler (vector strve |
||||
FREE(buff); |
||||
return 0; |
||||
} |
||||
- else if (parse_prkey(buff, &prkey) != 0) { |
||||
+ else if (parse_prkey_flags(buff, &prkey, &flags) != 0) { |
||||
FREE(buff); |
||||
return 1; |
||||
} |
||||
|
||||
mpe->prkey_source = PRKEY_SOURCE_CONF; |
||||
+ mpe->sa_flags = flags; |
||||
put_be64(mpe->reservation_key, prkey); |
||||
FREE(buff); |
||||
return 0; |
||||
@@ -2838,14 +2844,17 @@ snprint_mp_prio_args(char * buff, int le |
||||
static int |
||||
snprint_mp_reservation_key (char * buff, int len, void * data) |
||||
{ |
||||
+ char *flagstr = ""; |
||||
struct mpentry * mpe = (struct mpentry *)data; |
||||
|
||||
if (mpe->prkey_source == PRKEY_SOURCE_NONE) |
||||
return 0; |
||||
if (mpe->prkey_source == PRKEY_SOURCE_FILE) |
||||
return snprintf(buff, len, "file"); |
||||
- return snprintf(buff, len, "0x%" PRIx64, |
||||
- get_be64(mpe->reservation_key)); |
||||
+ if (mpe->sa_flags == MPATH_F_APTPL_MASK) |
||||
+ flagstr = ":aptpl"; |
||||
+ return snprintf(buff, len, "0x%" PRIx64 "%s", |
||||
+ get_be64(mpe->reservation_key), flagstr); |
||||
} |
||||
|
||||
static int |
||||
@@ -3716,12 +3725,15 @@ snprint_def_prkeys_file (char * buff, in |
||||
static int |
||||
snprint_def_reservation_key(char * buff, int len, void * data) |
||||
{ |
||||
+ char *flagstr = ""; |
||||
if (conf->prkey_source == PRKEY_SOURCE_NONE) |
||||
return 0; |
||||
if (conf->prkey_source == PRKEY_SOURCE_FILE) |
||||
return snprintf(buff, len, "file"); |
||||
- return snprintf(buff, len, "0x%" PRIx64, |
||||
- get_be64(conf->reservation_key)); |
||||
+ if (conf->sa_flags == MPATH_F_APTPL_MASK) |
||||
+ flagstr = ":aptpl"; |
||||
+ return snprintf(buff, len, "0x%" PRIx64 "%s", |
||||
+ get_be64(conf->reservation_key), flagstr); |
||||
} |
||||
|
||||
static int |
||||
Index: multipath-tools-130222/libmpathpersist/mpath_persist.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c |
||||
+++ multipath-tools-130222/libmpathpersist/mpath_persist.c |
||||
@@ -295,7 +295,8 @@ int mpath_persistent_reserve_out ( int f |
||||
rq_servact == MPATH_PROUT_REG_SA) || |
||||
rq_servact == MPATH_PROUT_REG_IGN_SA)) { |
||||
memcpy(&mpp->reservation_key, paramp->sa_key, 8); |
||||
- if (update_prkey(alias, get_be64(mpp->reservation_key))) { |
||||
+ if (update_prkey_flags(alias, get_be64(mpp->reservation_key), |
||||
+ paramp->sa_flags)) { |
||||
condlog(0, "%s: failed to set prkey for multipathd.", |
||||
alias); |
||||
ret = MPATH_PR_DMMP_ERROR; |
||||
Index: multipath-tools-130222/libmpathpersist/mpath_updatepr.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmpathpersist/mpath_updatepr.c |
||||
+++ multipath-tools-130222/libmpathpersist/mpath_updatepr.c |
||||
@@ -15,6 +15,8 @@ |
||||
#include <mpath_cmd.h> |
||||
#include <uxsock.h> |
||||
#include "memory.h" |
||||
+#include <libudev.h> |
||||
+#include <mpath_persist.h> |
||||
|
||||
unsigned long mem_allocated; /* Total memory used in Bytes */ |
||||
|
||||
@@ -54,11 +56,15 @@ int update_prflag(char *mapname, int set |
||||
return do_update_pr(mapname, (set)? "setprstatus" : "unsetprstatus"); |
||||
} |
||||
|
||||
-int update_prkey(char *mapname, uint64_t prkey) { |
||||
+int update_prkey_flags(char *mapname, uint64_t prkey, uint8_t sa_flags) { |
||||
char str[256]; |
||||
+ char *flagstr = ""; |
||||
|
||||
+ if (sa_flags & MPATH_F_APTPL_MASK) |
||||
+ flagstr = ":aptpl"; |
||||
if (prkey) |
||||
- snprintf(str, sizeof(str), "setprkey key %" PRIx64, prkey); |
||||
+ snprintf(str, sizeof(str), "setprkey key %" PRIx64 "%s", prkey, |
||||
+ flagstr); |
||||
else |
||||
snprintf(str, sizeof(str), "unsetprkey"); |
||||
return do_update_pr(mapname, str); |
||||
Index: multipath-tools-130222/libmpathpersist/mpathpr.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmpathpersist/mpathpr.h |
||||
+++ multipath-tools-130222/libmpathpersist/mpathpr.h |
||||
@@ -50,7 +50,8 @@ int send_prout_activepath(char * dev, in |
||||
unsigned int rq_type, struct prout_param_descriptor * paramp, int noisy); |
||||
|
||||
int update_prflag(char *mapname, int set); |
||||
-int update_prkey(char *mapname, uint64_t prkey); |
||||
+int update_prkey_flags(char *mapname, uint64_t prkey, uint8_t sa_flags); |
||||
+#define update_prkey(mapname, prkey) update_prkey_flags(mapname, prkey, 0) |
||||
void * mpath_alloc_prin_response(int prin_sa); |
||||
int update_map_pr(struct multipath *mpp); |
||||
int devt2devname (char *devname, char *devt); |
||||
Index: multipath-tools-130222/libmultipath/prkey.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/prkey.c |
||||
+++ multipath-tools-130222/libmultipath/prkey.c |
||||
@@ -11,6 +11,8 @@ |
||||
#include <string.h> |
||||
#include <inttypes.h> |
||||
#include <errno.h> |
||||
+#include <libudev.h> |
||||
+#include <mpath_persist.h> |
||||
|
||||
#define KEYSIZE 19 |
||||
#define PRKEY_READ 0 |
||||
@@ -109,7 +111,7 @@ static int do_prkey(int fd, char *wwid, |
||||
return 0; |
||||
} |
||||
|
||||
-int get_prkey(struct multipath *mpp, uint64_t *prkey) |
||||
+int get_prkey(struct multipath *mpp, uint64_t *prkey, uint8_t *sa_flags) |
||||
{ |
||||
int fd; |
||||
int unused; |
||||
@@ -125,6 +127,9 @@ int get_prkey(struct multipath *mpp, uin |
||||
ret = do_prkey(fd, mpp->wwid, keystr, PRKEY_READ); |
||||
if (ret) |
||||
goto out_file; |
||||
+ *sa_flags = 0; |
||||
+ if (strchr(keystr, 'X')) |
||||
+ *sa_flags = MPATH_F_APTPL_MASK; |
||||
ret = !!parse_prkey(keystr, prkey); |
||||
out_file: |
||||
close(fd); |
||||
@@ -132,7 +137,7 @@ out: |
||||
return ret; |
||||
} |
||||
|
||||
-int set_prkey(struct multipath *mpp, uint64_t prkey) |
||||
+int set_prkey(struct multipath *mpp, uint64_t prkey, uint8_t sa_flags) |
||||
{ |
||||
int fd; |
||||
int can_write = 1; |
||||
@@ -142,6 +147,12 @@ int set_prkey(struct multipath *mpp, uin |
||||
if (!strlen(mpp->wwid)) |
||||
goto out; |
||||
|
||||
+ if (sa_flags & ~MPATH_F_APTPL_MASK) { |
||||
+ condlog(0, "unsupported pr flags, 0x%x", |
||||
+ sa_flags & ~MPATH_F_APTPL_MASK); |
||||
+ sa_flags &= MPATH_F_APTPL_MASK; |
||||
+ } |
||||
+ |
||||
fd = open_file(conf->prkeys_file, &can_write, PRKEYS_FILE_HEADER); |
||||
if (fd < 0) |
||||
goto out; |
||||
@@ -150,7 +161,15 @@ int set_prkey(struct multipath *mpp, uin |
||||
goto out_file; |
||||
} |
||||
if (prkey) { |
||||
- snprintf(keystr, KEYSIZE, "0x%016" PRIx64, prkey); |
||||
+ /* using the capitalization of the 'x' is a hack, but |
||||
+ * it's unlikely that mpath_persist will support more options |
||||
+ * since sg_persist doesn't, and this lets us keep the |
||||
+ * same file format as before instead of needing to change |
||||
+ * the format of the prkeys file */ |
||||
+ if (sa_flags) |
||||
+ snprintf(keystr, KEYSIZE, "0X%016" PRIx64, prkey); |
||||
+ else |
||||
+ snprintf(keystr, KEYSIZE, "0x%016" PRIx64, prkey); |
||||
keystr[KEYSIZE - 1] = '\0'; |
||||
ret = do_prkey(fd, mpp->wwid, keystr, PRKEY_WRITE); |
||||
} |
||||
Index: multipath-tools-130222/libmultipath/prkey.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/prkey.h |
||||
+++ multipath-tools-130222/libmultipath/prkey.h |
||||
@@ -13,7 +13,7 @@ |
||||
"# prkey wwid\n" \ |
||||
"#\n" |
||||
|
||||
-int set_prkey(struct multipath *mpp, uint64_t prkey); |
||||
-int get_prkey(struct multipath *mpp, uint64_t *prkey); |
||||
+int set_prkey(struct multipath *mpp, uint64_t prkey, uint8_t sa_flags); |
||||
+int get_prkey(struct multipath *mpp, uint64_t *prkey, uint8_t *sa_flags); |
||||
|
||||
#endif /* _PRKEY_H */ |
||||
Index: multipath-tools-130222/libmultipath/propsel.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/propsel.c |
||||
+++ multipath-tools-130222/libmultipath/propsel.c |
||||
@@ -20,6 +20,8 @@ |
||||
#include "prioritizers/alua_rtpg.h" |
||||
#include "prkey.h" |
||||
#include <inttypes.h> |
||||
+#include <libudev.h> |
||||
+#include <mpath_persist.h> |
||||
|
||||
pgpolicyfn *pgpolicies[] = { |
||||
NULL, |
||||
@@ -715,10 +717,12 @@ select_reservation_key (struct multipath |
||||
uint64_t prkey; |
||||
char *origin = NULL; |
||||
char *from_file = ""; |
||||
+ char *flagstr = ""; |
||||
|
||||
if (mp->mpe && mp->mpe->prkey_source != PRKEY_SOURCE_NONE) { |
||||
mp->prkey_source = mp->mpe->prkey_source; |
||||
mp->reservation_key = mp->mpe->reservation_key; |
||||
+ mp->sa_flags = mp->mpe->sa_flags; |
||||
origin = "multipath setting"; |
||||
goto out; |
||||
} |
||||
@@ -726,6 +730,7 @@ select_reservation_key (struct multipath |
||||
if (conf->prkey_source != PRKEY_SOURCE_NONE) { |
||||
mp->prkey_source = conf->prkey_source; |
||||
mp->reservation_key = conf->reservation_key; |
||||
+ mp->sa_flags = conf->sa_flags; |
||||
origin = "config file default"; |
||||
goto out; |
||||
} |
||||
@@ -736,14 +741,16 @@ select_reservation_key (struct multipath |
||||
out: |
||||
if (mp->prkey_source == PRKEY_SOURCE_FILE) { |
||||
from_file = " (from prkeys file)"; |
||||
- if (get_prkey(mp, &prkey) != 0) |
||||
+ if (get_prkey(mp, &prkey, &mp->sa_flags) != 0) |
||||
put_be64(mp->reservation_key, 0); |
||||
else |
||||
put_be64(mp->reservation_key, prkey); |
||||
} |
||||
+ if (mp->sa_flags & MPATH_F_APTPL_MASK) |
||||
+ flagstr = ":aptpl"; |
||||
if (get_be64(mp->reservation_key)) |
||||
- condlog(0, "%s: reservation_key = 0x%" PRIx64 " (%s)%s", |
||||
- mp->alias, get_be64(mp->reservation_key), origin, |
||||
+ condlog(0, "%s: reservation_key = 0x%" PRIx64 "%s (%s)%s", |
||||
+ mp->alias, get_be64(mp->reservation_key), flagstr, origin, |
||||
from_file); |
||||
return 0; |
||||
} |
||||
Index: multipath-tools-130222/multipathd/cli_handlers.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipathd/cli_handlers.c |
||||
+++ multipath-tools-130222/multipathd/cli_handlers.c |
||||
@@ -17,6 +17,7 @@ |
||||
#include <sysfs.h> |
||||
#include <errno.h> |
||||
#include <libudev.h> |
||||
+#include <mpath_persist.h> |
||||
#include <util.h> |
||||
#include <prkey.h> |
||||
|
||||
@@ -1242,6 +1243,7 @@ cli_getprkey(void * v, char ** reply, in |
||||
struct multipath * mpp; |
||||
struct vectors * vecs = (struct vectors *)data; |
||||
char *mapname = get_keyparam(v, MAP); |
||||
+ char *flagstr = ""; |
||||
|
||||
mapname = convert_dev(mapname, 0); |
||||
condlog(3, "%s: get persistent reservation key (operator)", mapname); |
||||
@@ -1257,8 +1259,10 @@ cli_getprkey(void * v, char ** reply, in |
||||
*len = strlen(*reply) + 1; |
||||
return 0; |
||||
} |
||||
- snprintf(*reply, 20, "0x%" PRIx64 "\n", |
||||
- get_be64(mpp->reservation_key)); |
||||
+ if (mpp->sa_flags & MPATH_F_APTPL_MASK) |
||||
+ flagstr = ":aptpl"; |
||||
+ snprintf(*reply, 20, "0x%" PRIx64 "%s\n", |
||||
+ get_be64(mpp->reservation_key), flagstr); |
||||
(*reply)[19] = '\0'; |
||||
*len = strlen(*reply) + 1; |
||||
return 0; |
||||
@@ -1278,7 +1282,7 @@ cli_unsetprkey(void * v, char ** reply, |
||||
if (!mpp) |
||||
return 1; |
||||
|
||||
- return set_prkey(mpp, 0); |
||||
+ return set_prkey(mpp, 0, 0); |
||||
} |
||||
|
||||
int cli_setprkey(void * v, char ** reply, int * len, void * data) |
||||
@@ -1288,6 +1292,7 @@ int cli_setprkey(void * v, char ** reply |
||||
char *mapname = get_keyparam(v, MAP); |
||||
char *keyparam = get_keyparam(v, KEY); |
||||
uint64_t prkey; |
||||
+ uint8_t flags; |
||||
|
||||
mapname = convert_dev(mapname, 0); |
||||
condlog(3, "%s: set persistent reservation key (operator)", mapname); |
||||
@@ -1296,10 +1301,10 @@ int cli_setprkey(void * v, char ** reply |
||||
if (!mpp) |
||||
return 1; |
||||
|
||||
- if (parse_prkey(keyparam, &prkey) != 0) { |
||||
+ if (parse_prkey_flags(keyparam, &prkey, &flags) != 0) { |
||||
condlog(0, "%s: invalid prkey : '%s'", mapname, keyparam); |
||||
return 1; |
||||
} |
||||
|
||||
- return set_prkey(mpp, prkey); |
||||
+ return set_prkey(mpp, prkey, flags); |
||||
} |
||||
Index: multipath-tools-130222/multipathd/main.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipathd/main.c |
||||
+++ multipath-tools-130222/multipathd/main.c |
||||
@@ -2324,6 +2324,7 @@ void * mpath_pr_event_handler_fn (void |
||||
|
||||
param= malloc(sizeof(struct prout_param_descriptor)); |
||||
memset(param, 0 , sizeof(struct prout_param_descriptor)); |
||||
+ param->sa_flags = mpp->sa_flags; |
||||
memcpy(param->sa_key, &mpp->reservation_key, 8); |
||||
param->num_transportid = 0; |
||||
|
||||
Index: multipath-tools-130222/multipath/multipath.conf.5 |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipath/multipath.conf.5 |
||||
+++ multipath-tools-130222/multipath/multipath.conf.5 |
||||
@@ -438,14 +438,18 @@ This is the service action reservation k |
||||
set for all multipath devices using persistent reservations, and it must be |
||||
the same as the RESERVATION KEY field of the PERSISTENT RESERVE OUT parameter |
||||
list which contains an 8-byte value provided by the application client to the |
||||
-device server to identify the I_T nexus. |
||||
+device server to identify the I_T nexus. If the \fI--param-aptpl\fR option is |
||||
+used when registering the key with mpathpersist, \fB:aptpl\fR must be appended |
||||
+to the end of the reservation key. |
||||
+ |
||||
.RS |
||||
.PP |
||||
Alternatively, this can be set to \fBfile\fR, which will store the RESERVATION |
||||
KEY registered by mpathpersist in the \fIprkeys_file\fR. multipathd will then |
||||
use this key to register additional paths as they appear. When the |
||||
registration is removed, the RESERVATION KEY is removed from the |
||||
-\fIprkeys_file\fR. |
||||
+\fIprkeys_file\fR. The prkeys file will automatically keep track of whether |
||||
+the key was registered with \fI--param-aptpl\fR. |
||||
It is unset by default. |
||||
.RE |
||||
.TP |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
--- |
||||
libmultipath/checkers/readsector0.c | 2 +- |
||||
1 file changed, 1 insertion(+), 1 deletion(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/checkers/readsector0.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/checkers/readsector0.c |
||||
+++ multipath-tools-130222/libmultipath/checkers/readsector0.c |
||||
@@ -29,7 +29,7 @@ int libcheck_check (struct checker * c) |
||||
unsigned char sbuf[SENSE_BUFF_LEN]; |
||||
int ret; |
||||
|
||||
- ret = sg_read(c->fd, &buf[0], 4069, &sbuf[0], |
||||
+ ret = sg_read(c->fd, &buf[0], 4096, &sbuf[0], |
||||
SENSE_BUFF_LEN, c->timeout); |
||||
|
||||
switch (ret) |
@ -0,0 +1,519 @@
@@ -0,0 +1,519 @@
|
||||
--- |
||||
libmultipath/blacklist.c | 50 ++++++++++++++++++++++++++---- |
||||
libmultipath/blacklist.h | 3 + |
||||
libmultipath/config.c | 16 +++++++++ |
||||
libmultipath/config.h | 2 + |
||||
libmultipath/dict.c | 38 +++++++++++++++++++++-- |
||||
libmultipath/discovery.c | 5 +-- |
||||
libmultipath/print.c | 74 +++++++++++++++++++++++++++++++++++++++++++++ |
||||
libmultipath/print.h | 2 + |
||||
libmultipath/structs.h | 1 |
||||
multipath/multipath.conf.5 | 15 +++++++++ |
||||
10 files changed, 194 insertions(+), 12 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmultipath/blacklist.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/blacklist.c |
||||
+++ multipath-tools-130222/libmultipath/blacklist.c |
||||
@@ -12,6 +12,8 @@ |
||||
#include "structs.h" |
||||
#include "config.h" |
||||
#include "blacklist.h" |
||||
+#include "structs_vec.h" |
||||
+#include "print.h" |
||||
|
||||
extern int |
||||
store_ble (vector blist, char * str, int origin) |
||||
@@ -211,12 +213,14 @@ setup_default_blist (struct config * con |
||||
condlog(3, "%s: (%s) %s", dev, wwid, (M)); \ |
||||
else if (env) \ |
||||
condlog(3, "%s: (%s) %s", dev, env, (M)); \ |
||||
+ else if (protocol) \ |
||||
+ condlog(3, "%s: (%s) %s", dev, protocol, (M)); \ |
||||
else \ |
||||
condlog(3, "%s: %s", dev, (M)) |
||||
|
||||
void |
||||
log_filter (const char *dev, char *vendor, char *product, char *wwid, |
||||
- const char *env, int r) |
||||
+ const char *env, char *protocol, int r) |
||||
{ |
||||
/* |
||||
* Try to sort from most likely to least. |
||||
@@ -236,6 +240,9 @@ log_filter (const char *dev, char *vendo |
||||
case MATCH_PROPERTY_BLIST: |
||||
LOG_BLIST("udev property blacklisted"); |
||||
break; |
||||
+ case MATCH_PROTOCOL_BLIST: |
||||
+ LOG_BLIST("protocol blacklisted"); |
||||
+ break; |
||||
case MATCH_DEVICE_BLIST_EXCEPT: |
||||
LOG_BLIST("vendor/product whitelisted"); |
||||
break; |
||||
@@ -251,6 +258,9 @@ log_filter (const char *dev, char *vendo |
||||
case MATCH_PROPERTY_BLIST_MISSING: |
||||
LOG_BLIST("blacklisted, udev property missing"); |
||||
break; |
||||
+ case MATCH_PROTOCOL_BLIST_EXCEPT: |
||||
+ LOG_BLIST("protocol whitelisted"); |
||||
+ break; |
||||
} |
||||
} |
||||
|
||||
@@ -270,7 +280,7 @@ int |
||||
filter_device (vector blist, vector elist, char * vendor, char * product) |
||||
{ |
||||
int r = _filter_device(blist, elist, vendor, product); |
||||
- log_filter(NULL, vendor, product, NULL, NULL, r); |
||||
+ log_filter(NULL, vendor, product, NULL, NULL, NULL, r); |
||||
return r; |
||||
} |
||||
|
||||
@@ -290,7 +300,7 @@ int |
||||
filter_devnode (vector blist, vector elist, char * dev) |
||||
{ |
||||
int r = _filter_devnode(blist, elist, dev); |
||||
- log_filter(dev, NULL, NULL, NULL, NULL, r); |
||||
+ log_filter(dev, NULL, NULL, NULL, NULL, NULL, r); |
||||
return r; |
||||
} |
||||
|
||||
@@ -310,7 +320,7 @@ int |
||||
filter_wwid (vector blist, vector elist, char * wwid) |
||||
{ |
||||
int r = _filter_wwid(blist, elist, wwid); |
||||
- log_filter(NULL, NULL, NULL, wwid, NULL, r); |
||||
+ log_filter(NULL, NULL, NULL, wwid, NULL, NULL, r); |
||||
return r; |
||||
} |
||||
|
||||
@@ -346,7 +356,7 @@ filter_property(struct config * conf, st |
||||
|
||||
r = _filter_property(conf, env); |
||||
if (r) { |
||||
- log_filter(devname, NULL, NULL, NULL, env, r); |
||||
+ log_filter(devname, NULL, NULL, NULL, env, NULL, r); |
||||
return r; |
||||
} |
||||
} |
||||
@@ -356,13 +366,35 @@ filter_property(struct config * conf, st |
||||
* the environment variable _has_ to match. |
||||
*/ |
||||
if (VECTOR_SIZE(conf->elist_property)) { |
||||
- log_filter(devname, NULL, NULL, NULL, NULL, |
||||
+ log_filter(devname, NULL, NULL, NULL, NULL, NULL, |
||||
MATCH_PROPERTY_BLIST_MISSING); |
||||
return MATCH_PROPERTY_BLIST_MISSING; |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
+static int |
||||
+_filter_protocol(vector blist, vector elist, char *protocol_str) |
||||
+{ |
||||
+ if (_blacklist_exceptions(elist, protocol_str)) |
||||
+ return MATCH_PROTOCOL_BLIST_EXCEPT; |
||||
+ if (_blacklist(blist, protocol_str)) |
||||
+ return MATCH_PROTOCOL_BLIST; |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
+int |
||||
+filter_protocol(vector blist, vector elist, struct path * pp) |
||||
+{ |
||||
+ char buf[PROTOCOL_BUF_SIZE]; |
||||
+ int r; |
||||
+ |
||||
+ snprint_path_protocol(buf, sizeof(buf), pp); |
||||
+ r = _filter_protocol(blist, elist, buf); |
||||
+ log_filter(pp->dev, NULL, NULL, NULL, NULL, buf, r); |
||||
+ return r; |
||||
+} |
||||
+ |
||||
int |
||||
_filter_path (struct config * conf, struct path * pp) |
||||
{ |
||||
@@ -371,6 +403,9 @@ _filter_path (struct config * conf, stru |
||||
r = filter_property(conf, pp->udev); |
||||
if (r > 0) |
||||
return r; |
||||
+ r = filter_protocol(conf->blist_protocol, conf->elist_protocol, pp); |
||||
+ if (r > 0) |
||||
+ return r; |
||||
r = _filter_devnode(conf->blist_devnode, conf->elist_devnode,pp->dev); |
||||
if (r > 0) |
||||
return r; |
||||
@@ -386,7 +421,8 @@ int |
||||
filter_path (struct config * conf, struct path * pp) |
||||
{ |
||||
int r=_filter_path(conf, pp); |
||||
- log_filter(pp->dev, pp->vendor_id, pp->product_id, pp->wwid, NULL, r); |
||||
+ log_filter(pp->dev, pp->vendor_id, pp->product_id, pp->wwid, NULL, |
||||
+ NULL, r); |
||||
return r; |
||||
} |
||||
|
||||
Index: multipath-tools-130222/libmultipath/blacklist.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/blacklist.h |
||||
+++ multipath-tools-130222/libmultipath/blacklist.h |
||||
@@ -10,10 +10,12 @@ |
||||
#define MATCH_DEVNODE_BLIST 3 |
||||
#define MATCH_PROPERTY_BLIST 4 |
||||
#define MATCH_PROPERTY_BLIST_MISSING 5 |
||||
+#define MATCH_PROTOCOL_BLIST 6 |
||||
#define MATCH_WWID_BLIST_EXCEPT -MATCH_WWID_BLIST |
||||
#define MATCH_DEVICE_BLIST_EXCEPT -MATCH_DEVICE_BLIST |
||||
#define MATCH_DEVNODE_BLIST_EXCEPT -MATCH_DEVNODE_BLIST |
||||
#define MATCH_PROPERTY_BLIST_EXCEPT -MATCH_PROPERTY_BLIST |
||||
+#define MATCH_PROTOCOL_BLIST_EXCEPT -MATCH_PROTOCOL_BLIST |
||||
|
||||
struct blentry { |
||||
char * str; |
||||
@@ -36,6 +38,7 @@ int filter_wwid (vector, vector, char *) |
||||
int filter_device (vector, vector, char *, char *); |
||||
int filter_path (struct config *, struct path *); |
||||
int filter_property(struct config *, struct udev_device *); |
||||
+int filter_protocol(vector, vector, struct path *); |
||||
int store_ble (vector, char *, int); |
||||
int set_ble_device (vector, char *, char *, int); |
||||
void free_blacklist (vector); |
||||
Index: multipath-tools-130222/libmultipath/config.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/config.c |
||||
+++ multipath-tools-130222/libmultipath/config.c |
||||
@@ -600,11 +600,13 @@ free_config (struct config * conf) |
||||
free_blacklist(conf->blist_devnode); |
||||
free_blacklist(conf->blist_wwid); |
||||
free_blacklist(conf->blist_property); |
||||
+ free_blacklist(conf->blist_protocol); |
||||
free_blacklist_device(conf->blist_device); |
||||
|
||||
free_blacklist(conf->elist_devnode); |
||||
free_blacklist(conf->elist_wwid); |
||||
free_blacklist(conf->elist_property); |
||||
+ free_blacklist(conf->elist_protocol); |
||||
free_blacklist_device(conf->elist_device); |
||||
|
||||
free_mptable(conf->mptable); |
||||
@@ -792,6 +794,13 @@ load_config (char * file, struct udev *u |
||||
goto out; |
||||
} |
||||
|
||||
+ if (conf->blist_protocol == NULL) { |
||||
+ conf->blist_protocol = vector_alloc(); |
||||
+ |
||||
+ if (!conf->blist_protocol) |
||||
+ goto out; |
||||
+ } |
||||
+ |
||||
if (conf->elist_devnode == NULL) { |
||||
conf->elist_devnode = vector_alloc(); |
||||
|
||||
@@ -819,6 +828,13 @@ load_config (char * file, struct udev *u |
||||
goto out; |
||||
} |
||||
|
||||
+ if (conf->elist_protocol == NULL) { |
||||
+ conf->elist_protocol = vector_alloc(); |
||||
+ |
||||
+ if (!conf->elist_protocol) |
||||
+ goto out; |
||||
+ } |
||||
+ |
||||
if (setup_default_blist(conf)) |
||||
goto out; |
||||
|
||||
Index: multipath-tools-130222/libmultipath/config.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/config.h |
||||
+++ multipath-tools-130222/libmultipath/config.h |
||||
@@ -194,10 +194,12 @@ struct config { |
||||
vector blist_wwid; |
||||
vector blist_device; |
||||
vector blist_property; |
||||
+ vector blist_protocol; |
||||
vector elist_devnode; |
||||
vector elist_wwid; |
||||
vector elist_device; |
||||
vector elist_property; |
||||
+ vector elist_protocol; |
||||
}; |
||||
|
||||
struct config * conf; |
||||
Index: multipath-tools-130222/libmultipath/dict.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/dict.c |
||||
+++ multipath-tools-130222/libmultipath/dict.c |
||||
@@ -1092,9 +1092,12 @@ blacklist_handler(vector strvec) |
||||
conf->blist_device = vector_alloc(); |
||||
if (!conf->blist_property) |
||||
conf->blist_property = vector_alloc(); |
||||
+ if (!conf->blist_protocol) |
||||
+ conf->blist_protocol = vector_alloc(); |
||||
|
||||
if (!conf->blist_devnode || !conf->blist_wwid || |
||||
- !conf->blist_device || !conf->blist_property) |
||||
+ !conf->blist_device || !conf->blist_property || |
||||
+ !conf->blist_protocol) |
||||
return 1; |
||||
|
||||
return 0; |
||||
@@ -1111,9 +1114,12 @@ blacklist_exceptions_handler(vector strv |
||||
conf->elist_device = vector_alloc(); |
||||
if (!conf->elist_property) |
||||
conf->elist_property = vector_alloc(); |
||||
+ if (!conf->elist_protocol) |
||||
+ conf->elist_protocol = vector_alloc(); |
||||
|
||||
if (!conf->elist_devnode || !conf->elist_wwid || |
||||
- !conf->elist_device || !conf->elist_property) |
||||
+ !conf->elist_device || !conf->elist_property || |
||||
+ !conf->elist_protocol) |
||||
return 1; |
||||
|
||||
return 0; |
||||
@@ -1198,6 +1204,32 @@ ble_except_property_handler(vector strve |
||||
} |
||||
|
||||
static int |
||||
+ble_protocol_handler(vector strvec) |
||||
+{ |
||||
+ char * buff; |
||||
+ |
||||
+ buff = set_value(strvec); |
||||
+ |
||||
+ if (!buff) |
||||
+ return 1; |
||||
+ |
||||
+ return store_ble(conf->blist_protocol, buff, ORIGIN_CONFIG); |
||||
+} |
||||
+ |
||||
+static int |
||||
+ble_except_protocol_handler(vector strvec) |
||||
+{ |
||||
+ char * buff; |
||||
+ |
||||
+ buff = set_value(strvec); |
||||
+ |
||||
+ if (!buff) |
||||
+ return 1; |
||||
+ |
||||
+ return store_ble(conf->elist_protocol, buff, ORIGIN_CONFIG); |
||||
+} |
||||
+ |
||||
+static int |
||||
ble_device_handler(vector strvec) |
||||
{ |
||||
return alloc_ble_device(conf->blist_device); |
||||
@@ -4021,6 +4053,7 @@ init_keywords(void) |
||||
install_keyword_multi("devnode", &ble_devnode_handler, &snprint_ble_simple); |
||||
install_keyword_multi("wwid", &ble_wwid_handler, &snprint_ble_simple); |
||||
install_keyword_multi("property", &ble_property_handler, &snprint_ble_simple); |
||||
+ install_keyword_multi("protocol", &ble_protocol_handler, &snprint_ble_simple); |
||||
install_keyword_multi("device", &ble_device_handler, NULL); |
||||
install_sublevel(); |
||||
install_keyword("vendor", &ble_vendor_handler, &snprint_bled_vendor); |
||||
@@ -4030,6 +4063,7 @@ init_keywords(void) |
||||
install_keyword_multi("devnode", &ble_except_devnode_handler, &snprint_ble_simple); |
||||
install_keyword_multi("wwid", &ble_except_wwid_handler, &snprint_ble_simple); |
||||
install_keyword_multi("property", &ble_except_property_handler, &snprint_ble_simple); |
||||
+ install_keyword_multi("protocol", &ble_except_protocol_handler, &snprint_ble_simple); |
||||
install_keyword_multi("device", &ble_except_device_handler, NULL); |
||||
install_sublevel(); |
||||
install_keyword("vendor", &ble_except_vendor_handler, &snprint_bled_vendor); |
||||
Index: multipath-tools-130222/libmultipath/print.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/print.c |
||||
+++ multipath-tools-130222/libmultipath/print.c |
||||
@@ -607,6 +607,48 @@ snprint_path_failures(char * buff, size_ |
||||
return snprint_int(buff, len, pp->failcount); |
||||
} |
||||
|
||||
+/* if you add a protocol string bigger than "scsi:unspec" you must |
||||
+ * also change PROTOCOL_BUF_SIZE */ |
||||
+int |
||||
+snprint_path_protocol(char * buff, size_t len, struct path * pp) |
||||
+{ |
||||
+ switch (pp->bus) { |
||||
+ case SYSFS_BUS_SCSI: |
||||
+ switch (pp->sg_id.proto_id) { |
||||
+ case SCSI_PROTOCOL_FCP: |
||||
+ return snprintf(buff, len, "scsi:fcp"); |
||||
+ case SCSI_PROTOCOL_SPI: |
||||
+ return snprintf(buff, len, "scsi:spi"); |
||||
+ case SCSI_PROTOCOL_SSA: |
||||
+ return snprintf(buff, len, "scsi:ssa"); |
||||
+ case SCSI_PROTOCOL_SBP: |
||||
+ return snprintf(buff, len, "scsi:sbp"); |
||||
+ case SCSI_PROTOCOL_SRP: |
||||
+ return snprintf(buff, len, "scsi:srp"); |
||||
+ case SCSI_PROTOCOL_ISCSI: |
||||
+ return snprintf(buff, len, "scsi:iscsi"); |
||||
+ case SCSI_PROTOCOL_SAS: |
||||
+ return snprintf(buff, len, "scsi:sas"); |
||||
+ case SCSI_PROTOCOL_ADT: |
||||
+ return snprintf(buff, len, "scsi:adt"); |
||||
+ case SCSI_PROTOCOL_ATA: |
||||
+ return snprintf(buff, len, "scsi:ata"); |
||||
+ case SCSI_PROTOCOL_UNSPEC: |
||||
+ default: |
||||
+ return snprintf(buff, len, "scsi:unspec"); |
||||
+ } |
||||
+ case SYSFS_BUS_CCW: |
||||
+ return snprintf(buff, len, "ccw"); |
||||
+ case SYSFS_BUS_CCISS: |
||||
+ return snprintf(buff, len, "cciss"); |
||||
+ case SYSFS_BUS_NVME: |
||||
+ return snprintf(buff, len, "nvme"); |
||||
+ case SYSFS_BUS_UNDEF: |
||||
+ default: |
||||
+ return snprintf(buff, len, "undef"); |
||||
+ } |
||||
+} |
||||
+ |
||||
struct multipath_data mpd[] = { |
||||
{'n', "name", 0, snprint_name}, |
||||
{'w', "uuid", 0, snprint_multipath_uuid}, |
||||
@@ -654,6 +696,7 @@ struct path_data pd[] = { |
||||
{'r', "target WWPN", 0, snprint_tgt_wwpn}, |
||||
{'a', "host adapter", 0, snprint_host_adapter}, |
||||
{'0', "failures", 0, snprint_path_failures}, |
||||
+ {'P', "protocol", 0, snprint_path_protocol}, |
||||
{0, NULL, 0 , NULL} |
||||
}; |
||||
|
||||
@@ -1435,6 +1478,19 @@ snprint_blacklist_report (char * buff, i |
||||
|
||||
if ((len - fwd - threshold) <= 0) |
||||
return len; |
||||
+ fwd += snprintf(buff + fwd, len - fwd, "protocol rules:\n" |
||||
+ "- blacklist:\n"); |
||||
+ if (!snprint_blacklist_group(buff, len, &fwd, &conf->blist_protocol)) |
||||
+ return len; |
||||
+ |
||||
+ if ((len - fwd - threshold) <= 0) |
||||
+ return len; |
||||
+ fwd += snprintf(buff + fwd, len - fwd, "- exceptions:\n"); |
||||
+ if (snprint_blacklist_group(buff, len, &fwd, &conf->elist_protocol) == 0) |
||||
+ return len; |
||||
+ |
||||
+ if ((len - fwd - threshold) <= 0) |
||||
+ return len; |
||||
fwd += snprintf(buff + fwd, len - fwd, "wwid rules:\n" |
||||
"- blacklist:\n"); |
||||
if (snprint_blacklist_group(buff, len, &fwd, &conf->blist_wwid) == 0) |
||||
@@ -1509,6 +1565,15 @@ snprint_blacklist (char * buff, int len) |
||||
if (fwd > len) |
||||
return len; |
||||
} |
||||
+ vector_foreach_slot (conf->blist_protocol, ble, i) { |
||||
+ kw = find_keyword(rootkw->sub, "protocol"); |
||||
+ if (!kw) |
||||
+ return 0; |
||||
+ fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n", |
||||
+ kw, ble); |
||||
+ if (fwd > len) |
||||
+ return len; |
||||
+ } |
||||
rootkw = find_keyword(rootkw->sub, "device"); |
||||
if (!rootkw) |
||||
return 0; |
||||
@@ -1582,6 +1647,15 @@ snprint_blacklist_except (char * buff, i |
||||
if (!kw) |
||||
return 0; |
||||
fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n", |
||||
+ kw, ele); |
||||
+ if (fwd > len) |
||||
+ return len; |
||||
+ } |
||||
+ vector_foreach_slot (conf->elist_protocol, ele, i) { |
||||
+ kw = find_keyword(rootkw->sub, "protocol"); |
||||
+ if (!kw) |
||||
+ return 0; |
||||
+ fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n", |
||||
kw, ele); |
||||
if (fwd > len) |
||||
return len; |
||||
Index: multipath-tools-130222/libmultipath/print.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/print.h |
||||
+++ multipath-tools-130222/libmultipath/print.h |
||||
@@ -115,6 +115,8 @@ int snprint_host_wwnn (char *, size_t, s |
||||
int snprint_host_wwpn (char *, size_t, struct path *); |
||||
int snprint_tgt_wwnn (char *, size_t, struct path *); |
||||
int snprint_tgt_wwpn (char *, size_t, struct path *); |
||||
+#define PROTOCOL_BUF_SIZE sizeof("scsi:unspec") |
||||
+int snprint_path_protocol(char *, size_t, struct path *); |
||||
|
||||
void print_multipath_topology (struct multipath * mpp, int verbosity); |
||||
void print_path (struct path * pp, char * style); |
||||
Index: multipath-tools-130222/libmultipath/structs.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/structs.h |
||||
+++ multipath-tools-130222/libmultipath/structs.h |
||||
@@ -57,7 +57,6 @@ enum failback_mode { |
||||
enum sysfs_buses { |
||||
SYSFS_BUS_UNDEF, |
||||
SYSFS_BUS_SCSI, |
||||
- SYSFS_BUS_IDE, |
||||
SYSFS_BUS_CCW, |
||||
SYSFS_BUS_CCISS, |
||||
SYSFS_BUS_NVME, |
||||
Index: multipath-tools-130222/libmultipath/discovery.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c |
||||
+++ multipath-tools-130222/libmultipath/discovery.c |
||||
@@ -1407,9 +1407,10 @@ pathinfo (struct path *pp, vector hwtabl |
||||
|
||||
if (mask & DI_BLACKLIST && mask & DI_SYSFS) { |
||||
if (filter_device(conf->blist_device, conf->elist_device, |
||||
- pp->vendor_id, pp->product_id) > 0) { |
||||
+ pp->vendor_id, pp->product_id) > 0 || |
||||
+ filter_protocol(conf->blist_protocol, conf->elist_protocol, |
||||
+ pp) > 0) |
||||
return PATHINFO_SKIPPED; |
||||
- } |
||||
} |
||||
|
||||
path_state = path_offline(pp); |
||||
Index: multipath-tools-130222/multipath/multipath.conf.5 |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipath/multipath.conf.5 |
||||
+++ multipath-tools-130222/multipath/multipath.conf.5 |
||||
@@ -640,6 +640,10 @@ Regular expression of the device nodes t |
||||
.B property |
||||
Regular expresion of the udev property to be excluded. |
||||
.TP |
||||
+.B protocol |
||||
+Regular expression of the protocol to be excluded. See below for a |
||||
+list of recognized protocols |
||||
+.TP |
||||
.B device |
||||
Subsection for the device description. This subsection recognizes the |
||||
.I vendor |
||||
@@ -648,6 +652,13 @@ and |
||||
keywords. For a full description of these keywords please see the |
||||
.I devices |
||||
section description. |
||||
+.LP |
||||
+The protocol strings that multipath recognizes are \fIscsi:fcp\fR, |
||||
+\fIscsi:spi\fR, \fIscsi:ssa\fR, \fIscsi:sbp\fR, \fIscsi:srp\fR, |
||||
+\fIscsi:iscsi\fR, \fIscsi:sas\fR, \fIscsi:adt\fR, \fIscsi:ata\fR, |
||||
+\fIscsi:unspec\fR, \fIccw\fR, \fIcciss\fR, \fInvme\fR, and \fIundef\fR. |
||||
+The protocol that a path is using can be viewed by running |
||||
+\fBmultipathd show paths format "%d %P"\fR |
||||
.SH "blacklist_exceptions section" |
||||
The |
||||
.I blacklist_exceptions |
||||
@@ -667,6 +678,10 @@ The \fIWorld Wide Identification\fR of a |
||||
.B property |
||||
Regular expresion of the udev property to be whitelisted. |
||||
.TP |
||||
+.B protocol |
||||
+Regular expression of the protocol to be whitelisted. See the |
||||
+\fBblacklist section\fR for a list of recognized protocols |
||||
+.TP |
||||
.B devnode |
||||
Regular expression of the device nodes to be whitelisted. |
||||
.TP |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
--- |
||||
multipath/mpathconf.8 | 14 ++++++++++++++ |
||||
1 file changed, 14 insertions(+) |
||||
|
||||
Index: multipath-tools-130222/multipath/mpathconf.8 |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipath/mpathconf.8 |
||||
+++ multipath-tools-130222/multipath/mpathconf.8 |
||||
@@ -61,6 +61,16 @@ Adds a line that blacklists all device n |
||||
.B /etc/multipath.conf |
||||
blacklist section. If no blacklist section exists, it will create one. |
||||
.TP |
||||
+.B --allow \fB<device>\fP |
||||
+Modifies the \fB/etc/multipath/conf\fP blacklist to blacklist all |
||||
+wwids and the blacklist_exceptions to whitelist \fB<device>\fP. \fB<device>\fP |
||||
+can be in the form of MAJOR:MINOR, a wwid, or the name of a device-mapper |
||||
+device, either a multipath device, or any device on stacked on top of one or |
||||
+more multipath devices. This command can be used multiple times to allow |
||||
+multiple devices. \fBNOTE:\fP This action will create a configuration file that |
||||
+mpathconf will not be able to revert back to its previous state. Because |
||||
+of this, \fB--outfile\fP is required when using \fB--allow\fP. |
||||
+.TP |
||||
.B --user_friendly_name \fP { \fBy\fP | \fBn\fP } |
||||
If set to \fBy\fP, this adds the line |
||||
.B user_friendly_names yes |
||||
@@ -76,6 +86,10 @@ to the |
||||
.B /etc/multipath.conf |
||||
defaults section. If set to \fBn\fP, this removes the line, if present. This |
||||
command can be used aldong with any other command. |
||||
+.TP |
||||
+.B --outfile \fB<filename>\fP |
||||
+Write the resulting multipath configuration to \fB<filename>\fP instead of |
||||
+\fB/etc/multipath.conf\fP. |
||||
.SH OPTIONS |
||||
.TP |
||||
.B --with_module\fP { \fBy\fP | \fBn\fP } |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
--- |
||||
mpathpersist/main.c | 2 ++ |
||||
mpathpersist/mpathpersist.8 | 3 +++ |
||||
2 files changed, 5 insertions(+) |
||||
|
||||
Index: multipath-tools-130222/mpathpersist/main.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/mpathpersist/main.c |
||||
+++ multipath-tools-130222/mpathpersist/main.c |
||||
@@ -677,6 +677,8 @@ static void usage() |
||||
" --out|-o request PR Out command\n" |
||||
" --param-aptpl|-Z PR Out parameter 'APTPL'\n" |
||||
" --read-keys|-k PR In: Read Keys\n" |
||||
+ " --param-rk=RK|-K RK PR Out parameter reservation " |
||||
+ "key\n" |
||||
" --param-sark=SARK|-S SARK PR Out parameter service " |
||||
"action\n" |
||||
" reservation key (SARK is in " |
||||
Index: multipath-tools-130222/mpathpersist/mpathpersist.8 |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/mpathpersist/mpathpersist.8 |
||||
+++ multipath-tools-130222/mpathpersist/mpathpersist.8 |
||||
@@ -48,6 +48,9 @@ PR Out parameter 'APTPL' |
||||
\fB\-\-read\-keys\fR|\-k |
||||
PR In: Read Keys |
||||
.TP |
||||
+\fB\-\-param\-rk\fR=\fIRK\fR|\-K RK |
||||
+PR Out parameter reservation key (RK is in hex) |
||||
+.TP |
||||
\fB\-\-param\-sark\fR=\fISARK\fR|\-S SARK |
||||
PR Out parameter service action |
||||
reservation key (SARK is in hex) |
@ -0,0 +1,228 @@
@@ -0,0 +1,228 @@
|
||||
--- |
||||
libmpathpersist/mpath_persist.c | 4 +++- |
||||
libmpathpersist/mpath_pr_ioctl.c | 4 +++- |
||||
libmpathpersist/mpathpr.h | 1 - |
||||
libmultipath/configure.c | 29 +++++++++++++++++++++++++++++ |
||||
libmultipath/configure.h | 1 + |
||||
mpathpersist/main.c | 8 +++++++- |
||||
multipath/main.c | 13 +------------ |
||||
multipathd/main.c | 28 +--------------------------- |
||||
8 files changed, 45 insertions(+), 43 deletions(-) |
||||
|
||||
Index: multipath-tools-130222/libmpathpersist/mpath_persist.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c |
||||
+++ multipath-tools-130222/libmpathpersist/mpath_persist.c |
||||
@@ -19,6 +19,7 @@ |
||||
#include <dmparser.h> |
||||
#include <ctype.h> |
||||
#include <propsel.h> |
||||
+#include <util.h> |
||||
|
||||
#include "mpath_persist.h" |
||||
#include "mpathpr.h" |
||||
@@ -71,7 +72,8 @@ updatepaths (struct multipath * mpp) |
||||
|
||||
vector_foreach_slot (pgp->paths, pp, j){ |
||||
if (!strlen(pp->dev)){ |
||||
- if (devt2devname(pp->dev, pp->dev_t)){ |
||||
+ if (devt2devname(pp->dev, sizeof(pp->dev), |
||||
+ pp->dev_t)){ |
||||
/* |
||||
* path is not in sysfs anymore |
||||
*/ |
||||
Index: multipath-tools-130222/libmpathpersist/mpath_pr_ioctl.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmpathpersist/mpath_pr_ioctl.c |
||||
+++ multipath-tools-130222/libmpathpersist/mpath_pr_ioctl.c |
||||
@@ -1,5 +1,6 @@ |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
+#include <errno.h> |
||||
|
||||
#include <sys/types.h> |
||||
#include <sys/stat.h> |
||||
@@ -306,7 +307,8 @@ int prin_do_scsi_ioctl(char * dev, int r |
||||
snprintf(devname, FILE_NAME_SIZE, "/dev/%s",dev); |
||||
fd = open(devname, O_WRONLY); |
||||
if(fd < 0){ |
||||
- condlog(0, "%s: Unable to open device ", dev); |
||||
+ condlog(0, "%s: Unable to open device: %s", devname, |
||||
+ strerror(errno)); |
||||
return MPATH_PR_FILE_ERROR; |
||||
} |
||||
|
||||
Index: multipath-tools-130222/libmpathpersist/mpathpr.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmpathpersist/mpathpr.h |
||||
+++ multipath-tools-130222/libmpathpersist/mpathpr.h |
||||
@@ -54,6 +54,5 @@ int update_prkey_flags(char *mapname, ui |
||||
#define update_prkey(mapname, prkey) update_prkey_flags(mapname, prkey, 0) |
||||
void * mpath_alloc_prin_response(int prin_sa); |
||||
int update_map_pr(struct multipath *mpp); |
||||
-int devt2devname (char *devname, char *devt); |
||||
|
||||
#endif |
||||
Index: multipath-tools-130222/mpathpersist/main.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/mpathpersist/main.c |
||||
+++ multipath-tools-130222/mpathpersist/main.c |
||||
@@ -5,6 +5,10 @@ |
||||
#include <fcntl.h> |
||||
#include <checkers.h> |
||||
#include <vector.h> |
||||
+#include <config.h> |
||||
+#include <structs.h> |
||||
+#include <structs_vec.h> |
||||
+#include <configure.h> |
||||
#include <util.h> |
||||
#include <structs.h> |
||||
#include <getopt.h> |
||||
@@ -264,7 +268,7 @@ int main (int argc, char * argv[]) |
||||
|
||||
/* set verbosity */ |
||||
noisy = (loglevel >= 3) ? 1 : hex; |
||||
- verbose = (loglevel >= 3)? 3: loglevel; |
||||
+ verbose = (loglevel >= 4)? 4 : loglevel; |
||||
|
||||
if ((prout_flag + prin_flag) == 0) |
||||
{ |
||||
@@ -356,6 +360,8 @@ int main (int argc, char * argv[]) |
||||
goto out; |
||||
} |
||||
|
||||
+ set_max_fds(conf->max_fds); |
||||
+ |
||||
/* open device */ |
||||
if ((fd = open (device_name, O_WRONLY)) < 0) |
||||
{ |
||||
Index: multipath-tools-130222/libmultipath/configure.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/configure.c |
||||
+++ multipath-tools-130222/libmultipath/configure.c |
||||
@@ -15,6 +15,8 @@ |
||||
#include <libdevmapper.h> |
||||
#include <libudev.h> |
||||
#include <mpath_cmd.h> |
||||
+#include <sys/time.h> |
||||
+#include <sys/resource.h> |
||||
|
||||
#include "checkers.h" |
||||
#include "vector.h" |
||||
@@ -1143,3 +1145,30 @@ extern int reload_map(struct vectors *ve |
||||
|
||||
return 0; |
||||
} |
||||
+ |
||||
+void set_max_fds(int max_fds) |
||||
+{ |
||||
+ struct rlimit fd_limit; |
||||
+ |
||||
+ if (!max_fds) |
||||
+ return; |
||||
+ |
||||
+ if (getrlimit(RLIMIT_NOFILE, &fd_limit) < 0) { |
||||
+ condlog(0, "can't get open fds limit: %s", |
||||
+ strerror(errno)); |
||||
+ fd_limit.rlim_cur = 0; |
||||
+ fd_limit.rlim_max = 0; |
||||
+ } |
||||
+ if (fd_limit.rlim_cur < conf->max_fds) { |
||||
+ fd_limit.rlim_cur = conf->max_fds; |
||||
+ if (fd_limit.rlim_max < conf->max_fds) |
||||
+ fd_limit.rlim_max = conf->max_fds; |
||||
+ if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) |
||||
+ condlog(0, "can't set open fds limit to %lu/%lu : %s", |
||||
+ fd_limit.rlim_cur, fd_limit.rlim_max, |
||||
+ strerror(errno)); |
||||
+ else |
||||
+ condlog(3, "set open fds limit to %lu/%lu", |
||||
+ fd_limit.rlim_cur, fd_limit.rlim_max); |
||||
+ } |
||||
+} |
||||
Index: multipath-tools-130222/libmultipath/configure.h |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/libmultipath/configure.h |
||||
+++ multipath-tools-130222/libmultipath/configure.h |
||||
@@ -33,3 +33,4 @@ int get_refwwid (char * dev, enum devtyp |
||||
int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh); |
||||
int sysfs_get_host_adapter_name(struct path *pp, char *adapter_name); |
||||
void trigger_uevents (struct multipath *mpp); |
||||
+void set_max_fds(int max_fds); |
||||
Index: multipath-tools-130222/multipath/main.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipath/main.c |
||||
+++ multipath-tools-130222/multipath/main.c |
||||
@@ -52,8 +52,6 @@ |
||||
#include <pgpolicies.h> |
||||
#include <version.h> |
||||
#include <errno.h> |
||||
-#include <sys/time.h> |
||||
-#include <sys/resource.h> |
||||
#include <wwids.h> |
||||
#include <file.h> |
||||
#include "dev_t.h" |
||||
@@ -638,16 +636,7 @@ main (int argc, char *argv[]) |
||||
} |
||||
} |
||||
conf->daemon = 0; |
||||
- |
||||
- if (conf->max_fds) { |
||||
- struct rlimit fd_limit; |
||||
- |
||||
- fd_limit.rlim_cur = conf->max_fds; |
||||
- fd_limit.rlim_max = conf->max_fds; |
||||
- if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) |
||||
- condlog(0, "can't set open fds limit to %d : %s", |
||||
- conf->max_fds, strerror(errno)); |
||||
- } |
||||
+ set_max_fds(conf->max_fds); |
||||
|
||||
if (init_checkers()) { |
||||
condlog(0, "failed to initialize checkers"); |
||||
Index: multipath-tools-130222/multipathd/main.c |
||||
=================================================================== |
||||
--- multipath-tools-130222.orig/multipathd/main.c |
||||
+++ multipath-tools-130222/multipathd/main.c |
||||
@@ -12,8 +12,6 @@ |
||||
#include <sys/types.h> |
||||
#include <fcntl.h> |
||||
#include <errno.h> |
||||
-#include <sys/time.h> |
||||
-#include <sys/resource.h> |
||||
#include <limits.h> |
||||
#include <linux/oom.h> |
||||
#include <libudev.h> |
||||
@@ -1946,31 +1944,7 @@ child (void * param) |
||||
|
||||
setlogmask(LOG_UPTO(conf->verbosity + 3)); |
||||
|
||||
- if (conf->max_fds) { |
||||
- struct rlimit fd_limit; |
||||
- |
||||
- if (getrlimit(RLIMIT_NOFILE, &fd_limit) < 0) { |
||||
- condlog(0, "can't get open fds limit: %s", |
||||
- strerror(errno)); |
||||
- fd_limit.rlim_cur = 0; |
||||
- fd_limit.rlim_max = 0; |
||||
- } |
||||
- if (fd_limit.rlim_cur < conf->max_fds) { |
||||
- fd_limit.rlim_cur = conf->max_fds; |
||||
- if (fd_limit.rlim_max < conf->max_fds) |
||||
- fd_limit.rlim_max = conf->max_fds; |
||||
- if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) { |
||||
- condlog(0, "can't set open fds limit to " |
||||
- "%lu/%lu : %s", |
||||
- fd_limit.rlim_cur, fd_limit.rlim_max, |
||||
- strerror(errno)); |
||||
- } else { |
||||
- condlog(3, "set open fds limit to %lu/%lu", |
||||
- fd_limit.rlim_cur, fd_limit.rlim_max); |
||||
- } |
||||
- } |
||||
- |
||||
- } |
||||
+ set_max_fds(conf->max_fds); |
||||
|
||||
vecs = gvecs = init_vecs(); |
||||
if (!vecs) { |
Loading…
Reference in new issue