|
|
4ae388 |
---
|
|
|
4ae388 |
libmultipath/configure.c | 2 -
|
|
|
4ae388 |
libmultipath/propsel.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
4ae388 |
2 files changed, 59 insertions(+), 1 deletion(-)
|
|
|
4ae388 |
|
|
|
4ae388 |
Index: multipath-tools-130222/libmultipath/configure.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmultipath/configure.c
|
|
|
4ae388 |
+++ multipath-tools-130222/libmultipath/configure.c
|
|
|
4ae388 |
@@ -282,6 +282,7 @@ setup_map (struct multipath * mpp, char
|
|
|
4ae388 |
select_pgpolicy(mpp);
|
|
|
4ae388 |
select_selector(mpp);
|
|
|
4ae388 |
select_features(mpp);
|
|
|
4ae388 |
+ select_retain_hwhandler(mpp);
|
|
|
4ae388 |
select_hwhandler(mpp);
|
|
|
4ae388 |
select_rr_weight(mpp);
|
|
|
4ae388 |
select_minio(mpp);
|
|
|
4ae388 |
@@ -293,7 +294,6 @@ setup_map (struct multipath * mpp, char
|
|
|
4ae388 |
select_fast_io_fail(mpp);
|
|
|
4ae388 |
select_dev_loss(mpp);
|
|
|
4ae388 |
select_reservation_key(mpp);
|
|
|
4ae388 |
- select_retain_hwhandler(mpp);
|
|
|
4ae388 |
select_deferred_remove(mpp);
|
|
|
4ae388 |
select_delay_watch_checks(mpp);
|
|
|
4ae388 |
select_delay_wait_checks(mpp);
|
|
|
4ae388 |
Index: multipath-tools-130222/libmultipath/propsel.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmultipath/propsel.c
|
|
|
4ae388 |
+++ multipath-tools-130222/libmultipath/propsel.c
|
|
|
4ae388 |
@@ -19,6 +19,8 @@
|
|
|
4ae388 |
#include "discovery.h"
|
|
|
4ae388 |
#include "prioritizers/alua_rtpg.h"
|
|
|
4ae388 |
#include "prkey.h"
|
|
|
4ae388 |
+#include "sysfs.h"
|
|
|
4ae388 |
+#include "util.h"
|
|
|
4ae388 |
#include <inttypes.h>
|
|
|
4ae388 |
#include <libudev.h>
|
|
|
4ae388 |
#include <mpath_persist.h>
|
|
|
4ae388 |
@@ -317,9 +319,65 @@ select_features (struct multipath * mp)
|
|
|
4ae388 |
return 0;
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
+static int get_dh_state(struct path *pp, char *value, size_t value_len)
|
|
|
4ae388 |
+{
|
|
|
4ae388 |
+ int ret;
|
|
|
4ae388 |
+ struct udev_device *ud;
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ if (pp->udev == NULL)
|
|
|
4ae388 |
+ return -1;
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ ud = udev_device_get_parent_with_subsystem_devtype(pp->udev, "scsi",
|
|
|
4ae388 |
+ "scsi_device");
|
|
|
4ae388 |
+ if (ud == NULL)
|
|
|
4ae388 |
+ return -1;
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ ret = sysfs_attr_get_value(ud, "dh_state", value, value_len);
|
|
|
4ae388 |
+ if (ret > 0)
|
|
|
4ae388 |
+ strchop(value);
|
|
|
4ae388 |
+ return ret;
|
|
|
4ae388 |
+}
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+static int
|
|
|
4ae388 |
+use_attached_hwhandler(struct multipath * mp)
|
|
|
4ae388 |
+{
|
|
|
4ae388 |
+ int i;
|
|
|
4ae388 |
+ struct path *pp;
|
|
|
4ae388 |
+ int attached_hwhandler = 0;
|
|
|
4ae388 |
+ /* dh_state is no longer than "detached" */
|
|
|
4ae388 |
+ char dh_state[10];
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ vector_foreach_slot (mp->paths, pp, i) {
|
|
|
4ae388 |
+ if (get_dh_state(pp, dh_state, sizeof(dh_state)) > 0 &&
|
|
|
4ae388 |
+ strcmp(dh_state, "detached") != 0) {
|
|
|
4ae388 |
+ if (!attached_hwhandler) {
|
|
|
4ae388 |
+ if (asprintf(&mp->hwhandler, "1 %s",
|
|
|
4ae388 |
+ dh_state) < 0)
|
|
|
4ae388 |
+ return 0;
|
|
|
4ae388 |
+ attached_hwhandler = 1;
|
|
|
4ae388 |
+ /* if we find 2 different hardware handlers, disable
|
|
|
4ae388 |
+ * retain_attached_hw_handler, and use the configured
|
|
|
4ae388 |
+ * handler */
|
|
|
4ae388 |
+ } else if (strcmp(dh_state, &mp->hwhandler[2]) != 0) {
|
|
|
4ae388 |
+ FREE(mp->hwhandler);
|
|
|
4ae388 |
+ mp->hwhandler = NULL;
|
|
|
4ae388 |
+ mp->retain_hwhandler = RETAIN_HWHANDLER_OFF;
|
|
|
4ae388 |
+ condlog(0, "%s: retain_attached_hw_hander disabled (inconsistent handlers on paths)", mp->alias);
|
|
|
4ae388 |
+ return 0;
|
|
|
4ae388 |
+ }
|
|
|
4ae388 |
+ }
|
|
|
4ae388 |
+ }
|
|
|
4ae388 |
+ return attached_hwhandler;
|
|
|
4ae388 |
+}
|
|
|
4ae388 |
+
|
|
|
4ae388 |
extern int
|
|
|
4ae388 |
select_hwhandler (struct multipath * mp)
|
|
|
4ae388 |
{
|
|
|
4ae388 |
+ if (mp->retain_hwhandler == RETAIN_HWHANDLER_ON &&
|
|
|
4ae388 |
+ use_attached_hwhandler(mp)) {
|
|
|
4ae388 |
+ condlog(3, "%s: hwhandler = %s (setting: retained by kernel driver)", mp->alias, mp->hwhandler);
|
|
|
4ae388 |
+ return 0;
|
|
|
4ae388 |
+ }
|
|
|
4ae388 |
if (mp->hwe && mp->hwe->hwhandler) {
|
|
|
4ae388 |
mp->hwhandler = mp->hwe->hwhandler;
|
|
|
4ae388 |
condlog(3, "%s: hwhandler = %s (controller setting)",
|