device-mapper-multipath/0197-RHBZ-1394059-max-sectors-kb.patch
Benjamin Marzinski f9dfbb37ac device-mapper-multipath-0.4.9-86
Modify 0136-RHBZ-1304687-wait-for-map-add.patch
  * switch to missing_uev_wait_timeout to stop waiting for uev
Refresh 0137-RHBZ-1280524-clear-chkr-msg.patch
Refresh 0150-RHBZ-1253913-fix-startup-msg.patch
Refresh 0154-UPBZ-1291406-disable-reinstate.patch
Refresh 0156-UPBZ-1313324-dont-fail-discovery.patch
Refresh 0161-RHBZ-1311659-no-kpartx.patch
Refresh 0167-RHBZ-1335176-fix-show-cmds.patch
Add 0173-RH-update-man-page.patch
Add 0174-RHBZ-1362396-modprobe.patch
  * make starting the multipathd service modprobe dm-multipath in the
    sysvinit scripts
Add 0175-RHBZ-1357382-ordering.patch
  * force multipathd.service to start after systemd-udev-trigger.service
Add 0176-RHBZ-1363830-fix-rename.patch
  * initialized a variable to make dm_rename not fail randomly
Add 0177-libmultipath-correctly-initialize-pp-sg_id.patch
  * This and all the following patches add the rbd patch checker
Add 0178-libmultipath-add-rbd-discovery.patch
Add 0179-multipath-tools-add-checker-callout-to-repair-path.patch
Add 0180-multipath-tools-Add-rbd-checker.patch
Add 0181-multipath-tools-Add-rbd-to-the-hwtable.patch
Add 0182-multipath-tools-check-for-initialized-checker-before.patch
Add 0183-multipathd-Don-t-call-repair-on-blacklisted-path.patch
Add 0184-rbd-fix-sync-repair-support.patch
Add 0185-rbd-check-for-nonshared-clients.patch
Add 0186-rbd-check-for-exclusive-lock-enabled.patch
Add 0187-rbd-fixup-log-messages.patch
Add 0188-RHBZ-1368501-dont-exit.patch
  * make multipathd not exit if it encounters recoverable errors on startup
Add 0189-RHBZ-1368211-remove-retries.patch
  * add "remove_retries" multipath.conf parameter to make multiple attempts
    to remove a multipath device if it is busy.
Add 0190-RHBZ-1380602-rbd-lock-on-read.patch
  * pass lock_on_read when remapping image
Add 0191-RHBZ-1169168-disable-changed-paths.patch
  * add "disabled_changed_wwids" multipath.conf parameter to disable
    paths whose wwid changes
Add 0192-RHBZ-1362409-infinibox-config.patch
Add 0194-RHBZ-1351964-kpartx-recurse.patch
  * fix recursion on corrupt dos partitions
Add 0195-RHBZ-1359510-no-daemon-msg.patch
  * print a messages when multipathd isn't running
Add 0196-RHBZ-1239173-dont-set-flag.patch
  * don't set reload flag on reloads when you gain your first
    valid path
Add 0197-RHBZ-1394059-max-sectors-kb.patch
  * add "max_sectors_kb" multipath.conf parameter to set max_sectors_kb
    on a multipath device and all its path devices
Add 0198-RHBZ-1372032-detect-path-checker.patch
  * add "detect_checker" multipath.conf parameter to detect ALUA arrays
    and set the path checker to TUR
Add 0199-RHBZ-1279355-3pardata-config.patch
Add 0200-RHBZ-1402092-orphan-status.patch
  * clear status on orphan paths
Add 0201-RHBZ-1403552-silence-warning.patch
Add 0202-RHBZ-1362120-skip-prio.patch
  * don't run prio on failed paths
Add 0203-RHBZ-1363718-add-msgs.patch
Add 0204-RHBZ-1406226-nimble-config.patch
Add 0205-RHBZ-1416569-reset-stats.patch
  * add "reset maps stats" and "reset map <map> stats" multipathd
    interactive commands to reset the stats tracked by multipathd
Add 0206-RHBZ-1239173-pt2-no-paths.patch
  * make multipath correctly disable scanning and rules running when
    it gets a uevent and there are not valid paths.
Add 0207-UP-add-libmpathcmd.patch
  * New shared library, libmpathcmd, that sends and receives messages from
    multipathd. device-mapper-multipath now uses this library internally.
Add 0208-UPBZ-1430097-multipathd-IPC-changes.patch
  * validation that modifying commands are coming from root.
Add 0209-UPBZ-1430097-multipath-C-API.patch
  * New shared library. libdmmp, that presents the information from multipathd
    in a structured manner to make it easier for callers to use
Add 0210-RH-fix-uninstall.patch
  * Minor compilation fixes
Add 0211-RH-strlen-fix.patch
  * checks that variables are not NULL before passing them to strlen
Add 0212-RHBZ-1431562-for-read-only.patch
Make 3 new subpackages
  * device-mapper-multipath-devel, libdmmp, and libdmmp-devel. libmpathcmd
    and libmpathprio are in device-mapper-multipath-libs and
    device-mapper-multipath-devel. libdmmp is in its own subpackages
Move libmpathprio devel files to device-mapper-multipath-devel
Added BuildRequires on librados2-devel
2017-04-10 18:57:22 -04:00

475 lines
14 KiB
Diff

---
libmultipath/config.c | 3 +
libmultipath/config.h | 3 +
libmultipath/configure.c | 1
libmultipath/defaults.h | 1
libmultipath/devmapper.c | 4 +-
libmultipath/dict.c | 87 +++++++++++++++++++++++++++++++++++++++++++++
libmultipath/discovery.c | 60 +++++++++++++++++++++++++++++++
libmultipath/discovery.h | 1
libmultipath/propsel.c | 25 ++++++++++++
libmultipath/propsel.h | 1
libmultipath/structs.h | 7 +++
multipath/multipath.conf.5 | 8 ++++
12 files changed, 200 insertions(+), 1 deletion(-)
Index: multipath-tools-130222/libmultipath/config.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/config.c
+++ multipath-tools-130222/libmultipath/config.c
@@ -344,6 +344,7 @@ merge_hwe (struct hwentry * dst, struct
merge_num(delay_watch_checks);
merge_num(delay_wait_checks);
merge_num(skip_kpartx);
+ merge_num(max_sectors_kb);
/*
* Make sure features is consistent with
@@ -405,6 +406,7 @@ overwrite_hwe (struct hwentry * dst, str
overwrite_num(delay_watch_checks);
overwrite_num(delay_wait_checks);
overwrite_num(skip_kpartx);
+ overwrite_num(max_sectors_kb);
/*
* Make sure features is consistent with
@@ -682,6 +684,7 @@ load_config (char * file, struct udev *u
conf->skip_kpartx = DEFAULT_SKIP_KPARTX;
conf->remove_retries = 0;
conf->disable_changed_wwids = 0;
+ conf->max_sectors_kb = DEFAULT_MAX_SECTORS_KB;
/*
* preload default hwtable
Index: multipath-tools-130222/libmultipath/config.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/config.h
+++ multipath-tools-130222/libmultipath/config.h
@@ -65,6 +65,7 @@ struct hwentry {
int delay_watch_checks;
int delay_wait_checks;
int skip_kpartx;
+ int max_sectors_kb;
char * bl_product;
};
@@ -92,6 +93,7 @@ struct mpentry {
int delay_watch_checks;
int delay_wait_checks;
int skip_kpartx;
+ int max_sectors_kb;
uid_t uid;
gid_t gid;
mode_t mode;
@@ -148,6 +150,7 @@ struct config {
int skip_kpartx;
int remove_retries;
int disable_changed_wwids;
+ int max_sectors_kb;
unsigned int version[3];
char * dev;
Index: multipath-tools-130222/libmultipath/configure.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/configure.c
+++ multipath-tools-130222/libmultipath/configure.c
@@ -295,6 +295,7 @@ setup_map (struct multipath * mpp, char
select_delay_watch_checks(mpp);
select_delay_wait_checks(mpp);
select_skip_kpartx(mpp);
+ select_max_sectors_kb(mpp);
sysfs_set_scsi_tmo(mpp);
/*
Index: multipath-tools-130222/libmultipath/defaults.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/defaults.h
+++ multipath-tools-130222/libmultipath/defaults.h
@@ -25,6 +25,7 @@
#define DEFAULT_RETRIGGER_TRIES 3
#define DEFAULT_UEV_WAIT_TIMEOUT 30
#define DEFAULT_SKIP_KPARTX SKIP_KPARTX_OFF
+#define DEFAULT_MAX_SECTORS_KB MAX_SECTORS_KB_UNDEF
#define DEFAULT_CHECKINT 5
#define MAX_CHECKINT(a) (a << 2)
Index: multipath-tools-130222/libmultipath/dict.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/dict.c
+++ multipath-tools-130222/libmultipath/dict.c
@@ -976,6 +976,22 @@ def_disable_changed_wwids_handler(vector
return 0;
}
+static int
+def_max_sectors_kb_handler(vector strvec)
+{
+ char * buff;
+
+ buff = set_value(strvec);
+ if (!buff)
+ return 1;
+
+ if ((conf->max_sectors_kb = atoi(buff)) < MAX_SECTORS_KB_MIN)
+ conf->max_sectors_kb = MAX_SECTORS_KB_UNDEF;
+
+ FREE(buff);
+ return 0;
+}
+
/*
* blacklist block handlers
*/
@@ -1765,6 +1781,26 @@ hw_delay_wait_checks_handler(vector strv
return 0;
}
+static int
+hw_max_sectors_kb_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 ((hwe->max_sectors_kb = atoi(buff)) < MAX_SECTORS_KB_MIN)
+ hwe->max_sectors_kb = MAX_SECTORS_KB_UNDEF;
+
+ FREE(buff);
+ return 0;
+}
+
/*
* multipaths block handlers
*/
@@ -2316,6 +2352,26 @@ mp_delay_wait_checks_handler(vector strv
return 0;
}
+static int
+mp_max_sectors_kb_handler(vector strvec)
+{
+ struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
+ char * buff;
+
+ if (!mpe)
+ return 1;
+
+ buff = set_value(strvec);
+ if (!buff)
+ return 1;
+
+ if ((mpe->max_sectors_kb = atoi(buff)) < MAX_SECTORS_KB_MIN)
+ mpe->max_sectors_kb = MAX_SECTORS_KB_UNDEF;
+
+ FREE(buff);
+ return 0;
+}
+
/*
* config file keywords printing
*/
@@ -2615,6 +2671,16 @@ snprint_mp_delay_wait_checks(char * buff
}
static int
+snprint_mp_max_sectors_kb(char * buff, int len, void * data)
+{
+ struct mpentry * mpe = (struct mpentry *)data;
+
+ if (mpe->max_sectors_kb == MAX_SECTORS_KB_UNDEF)
+ return 0;
+ return snprintf(buff, len, "%d", mpe->max_sectors_kb);
+}
+
+static int
snprint_hw_fast_io_fail(char * buff, int len, void * data)
{
struct hwentry * hwe = (struct hwentry *)data;
@@ -2993,6 +3059,16 @@ snprint_detect_prio(char * buff, int len
}
static int
+snprint_hw_max_sectors_kb(char * buff, int len, void * data)
+{
+ struct hwentry * hwe = (struct hwentry *)data;
+
+ if (hwe->max_sectors_kb == MAX_SECTORS_KB_UNDEF)
+ return 0;
+ return snprintf(buff, len, "%d", hwe->max_sectors_kb);
+}
+
+static int
snprint_def_polling_interval (char * buff, int len, void * data)
{
return snprintf(buff, len, "%i", conf->checkint);
@@ -3461,6 +3537,14 @@ snprint_def_disable_changed_wwids(char *
}
static int
+snprint_def_max_sectors_kb(char * buff, int len, void * data)
+{
+ if (conf->max_sectors_kb == MAX_SECTORS_KB_UNDEF)
+ return 0;
+ return snprintf(buff, len, "%d", conf->max_sectors_kb);
+}
+
+static int
snprint_ble_simple (char * buff, int len, void * data)
{
struct blentry * ble = (struct blentry *)data;
@@ -3541,6 +3625,7 @@ init_keywords(void)
install_keyword("new_bindings_in_boot", &def_new_bindings_in_boot_handler, &snprint_def_new_bindings_in_boot);
install_keyword("remove_retries", &def_remove_retries_handler, &snprint_def_remove_retries);
install_keyword("disable_changed_wwids", &def_disable_changed_wwids_handler, &snprint_def_disable_changed_wwids);
+ install_keyword("max_sectors_kb", &def_max_sectors_kb_handler, &snprint_def_max_sectors_kb);
__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);
@@ -3609,6 +3694,7 @@ init_keywords(void)
install_keyword("delay_watch_checks", &hw_delay_watch_checks_handler, &snprint_hw_delay_watch_checks);
install_keyword("delay_wait_checks", &hw_delay_wait_checks_handler, &snprint_hw_delay_wait_checks);
install_keyword("skip_kpartx", &hw_skip_kpartx_handler, &snprint_hw_skip_kpartx);
+ install_keyword("max_sectors_kb", &hw_max_sectors_kb_handler, &snprint_hw_max_sectors_kb);
install_sublevel_end();
install_keyword_root("multipaths", &multipaths_handler);
@@ -3637,5 +3723,6 @@ init_keywords(void)
install_keyword("delay_watch_checks", &mp_delay_watch_checks_handler, &snprint_mp_delay_watch_checks);
install_keyword("delay_wait_checks", &mp_delay_wait_checks_handler, &snprint_mp_delay_wait_checks);
install_keyword("skip_kpartx", &mp_skip_kpartx_handler, &snprint_mp_skip_kpartx);
+ install_keyword("max_sectors_kb", &mp_max_sectors_kb_handler, &snprint_mp_max_sectors_kb);
install_sublevel_end();
}
Index: multipath-tools-130222/libmultipath/discovery.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/discovery.c
+++ multipath-tools-130222/libmultipath/discovery.c
@@ -12,6 +12,7 @@
#include <errno.h>
#include <libgen.h>
#include <libudev.h>
+#include <libdevmapper.h>
#include "checkers.h"
#include "vector.h"
@@ -27,6 +28,7 @@
#include "discovery.h"
#include "prio.h"
#include "defaults.h"
+#include "devmapper.h"
int
store_pathinfo (vector pathvec, vector hwtable, struct udev_device *udevice,
@@ -166,6 +168,64 @@ declare_sysfs_get_str(rev);
declare_sysfs_get_str(dev);
int
+sysfs_set_max_sectors_kb(struct multipath *mpp, int is_reload)
+{
+ struct pathgroup * pgp;
+ struct path *pp;
+ char buff[11];
+ struct udev_device *udevice = NULL;
+ int i, j, len, ret;
+ int max_sectors_kb;
+
+ if (mpp->max_sectors_kb == MAX_SECTORS_KB_UNDEF)
+ return 0;
+ max_sectors_kb = mpp->max_sectors_kb;
+ if (is_reload) {
+ if (!mpp->dmi && dm_get_info(mpp->alias, &mpp->dmi) != 0) {
+ condlog(0, "failed to get dm info on %s to set max_sectors_kb", mpp->alias);
+ return 1;
+ }
+ udevice = udev_device_new_from_devnum(conf->udev, 'b',
+ makedev(mpp->dmi->major,
+ mpp->dmi->minor));
+ if (!udevice) {
+ condlog(0, "failed to get udev device to set max_sectors_kb for %s", mpp->alias);
+ return 1;
+ }
+ if (sysfs_attr_get_value(udevice, "queue/max_sectors_kb",
+ buff, sizeof(buff)) <= 0) {
+ condlog(0, "failed to get current max_sectors_kb from %s", mpp->alias);
+ goto fail_reload;
+ }
+ if (sscanf(buff, "%u\n", &max_sectors_kb) != 1) {
+ condlog(0, "can't parse current max_sectors_kb from %s",
+ mpp->alias);
+ goto fail_reload;
+ }
+ udev_device_unref(udevice);
+ }
+ snprintf(buff, 11, "%d", max_sectors_kb);
+ len = strlen(buff);
+
+ vector_foreach_slot (mpp->pg, pgp, i) {
+ vector_foreach_slot (pgp->paths, pp, j) {
+ ret = sysfs_attr_set_value(pp->udev,
+ "queue/max_sectors_kb",
+ buff, len);
+ if (ret < 0) {
+ condlog(0, "failed setting max_sectors_kb on %s : %s", pp->dev, strerror(-ret));
+ return 1;
+ }
+ }
+ }
+ return 0;
+
+fail_reload:
+ udev_device_unref(udevice);
+ return 1;
+}
+
+int
sysfs_get_timeout(struct path *pp, unsigned int *timeout)
{
const char *attr = NULL;
Index: multipath-tools-130222/libmultipath/discovery.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/discovery.h
+++ multipath-tools-130222/libmultipath/discovery.h
@@ -41,6 +41,7 @@ int store_pathinfo (vector pathvec, vect
struct udev_device *udevice, int flag,
struct path **pp_ptr);
int sysfs_set_scsi_tmo (struct multipath *mpp);
+int sysfs_set_max_sectors_kb(struct multipath *mpp, int is_reload);
int sysfs_get_timeout(struct path *pp, unsigned int *timeout);
int sysfs_get_host_pci_name(struct path *pp, char *pci_name);
int sysfs_get_iscsi_ip_address(struct path *pp, char *ip_address);
Index: multipath-tools-130222/libmultipath/propsel.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/propsel.c
+++ multipath-tools-130222/libmultipath/propsel.c
@@ -880,3 +880,28 @@ select_skip_kpartx (struct multipath * m
condlog(3, "skip_kpartx = DISABLED (internal default)");
return 0;
}
+
+extern int
+select_max_sectors_kb (struct multipath * mp)
+{
+ if (mp->mpe && mp->mpe->max_sectors_kb != MAX_SECTORS_KB_UNDEF) {
+ mp->max_sectors_kb = mp->mpe->max_sectors_kb;
+ condlog(3, "max_sectors_kb = %i (multipath setting)",
+ mp->max_sectors_kb);
+ return 0;
+ }
+ if (mp->hwe && mp->hwe->max_sectors_kb != MAX_SECTORS_KB_UNDEF) {
+ mp->max_sectors_kb = mp->hwe->max_sectors_kb;
+ condlog(3, "max_sectors_kb = %i (controler setting)",
+ mp->max_sectors_kb);
+ return 0;
+ }
+ if (conf->max_sectors_kb != MAX_SECTORS_KB_UNDEF) {
+ mp->max_sectors_kb = conf->max_sectors_kb;
+ condlog(3, "max_sectors_kb = %i (config file default)",
+ mp->max_sectors_kb);
+ return 0;
+ }
+ mp->max_sectors_kb = MAX_SECTORS_KB_UNDEF;
+ return 0;
+}
Index: multipath-tools-130222/libmultipath/propsel.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/propsel.h
+++ multipath-tools-130222/libmultipath/propsel.h
@@ -24,3 +24,4 @@ int select_deferred_remove(struct multip
int select_delay_watch_checks (struct multipath * mp);
int select_delay_wait_checks (struct multipath * mp);
int select_skip_kpartx (struct multipath * mp);
+int select_max_sectors_kb (struct multipath * mp);
Index: multipath-tools-130222/libmultipath/structs.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/structs.h
+++ multipath-tools-130222/libmultipath/structs.h
@@ -128,6 +128,12 @@ enum skip_kpartx_states {
SKIP_KPARTX_ON,
};
+
+enum max_sectors_kb_states {
+ MAX_SECTORS_KB_UNDEF = 0,
+ MAX_SECTORS_KB_MIN = 4, /* can't be smaller than page size */
+};
+
enum scsi_protocol {
SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */
SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */
@@ -245,6 +251,7 @@ struct multipath {
int delay_wait_checks;
int force_udev_reload;
int skip_kpartx;
+ int max_sectors_kb;
unsigned int dev_loss;
uid_t uid;
gid_t gid;
Index: multipath-tools-130222/multipath/multipath.conf.5
===================================================================
--- multipath-tools-130222.orig/multipath/multipath.conf.5
+++ multipath-tools-130222/multipath/multipath.conf.5
@@ -561,6 +561,10 @@ default is
This sets how may times multipath will retry removing a device that is in-use.
Between each attempt, multipath will sleep 1 second. The default is
.I 0
+.TP
+.B max_sectors_kb
+Sets the max_sectors_kb device parameter on all path devices and the multipath
+device to the specified value. Default is device dependent.
.
.SH "blacklist section"
The
@@ -672,6 +676,8 @@ section:
.B delay_wait_checks
.TP
.B skip_kpartx
+.TP
+.B max_sectors_kb
.RE
.PD
.LP
@@ -772,6 +778,8 @@ section:
.B delay_wait_checks
.TP
.B skip_kpartx
+.TP
+.B max_sectors_kb
.RE
.PD
.LP
Index: multipath-tools-130222/libmultipath/devmapper.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/devmapper.c
+++ multipath-tools-130222/libmultipath/devmapper.c
@@ -21,7 +21,7 @@
#include "devmapper.h"
#include "config.h"
#include "sysfs.h"
-
+#include "discovery.h"
#include "log_pthread.h"
#include <sys/types.h>
#include <time.h>
@@ -330,6 +330,7 @@ extern int
dm_addmap_create (struct multipath *mpp, char * params) {
int ro;
+ sysfs_set_max_sectors_kb(mpp, 0);
for (ro = 0; ro <= 1; ro++) {
int err;
@@ -356,6 +357,7 @@ dm_addmap_create (struct multipath *mpp,
extern int
dm_addmap_reload (struct multipath *mpp, char *params) {
+ sysfs_set_max_sectors_kb(mpp, 1);
if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW, SKIP_KPARTX_OFF))
return 1;
if (errno != EROFS)