@@ -2245,7 +2245,7 @@ static ssize_t uid_fallback(struct path *pp, int path_state,
return len;
}
-bool has_uid_fallback(struct path *pp)
+static bool has_uid_fallback(const struct path *pp)
{
/*
* Falling back to direct WWID determination is dangerous
@@ -2266,6 +2266,16 @@ bool has_uid_fallback(struct path *pp)
!strcmp(pp->uid_attribute, ""))));
}
+bool can_recheck_wwid(const struct path *pp)
+{
+ /*
+ * check_path_wwid_change() only works for scsi devices, and it
+ * is only guaranteed to give the same WWID if the path uses
+ * the default uid_attribute
+ */
+ return (pp->bus == SYSFS_BUS_SCSI && has_uid_fallback(pp));
+}
+
int
get_uid (struct path * pp, int path_state, struct udev_device *udev,
int allow_fallback)
@@ -55,7 +55,7 @@ ssize_t sysfs_get_inquiry(struct udev_device *udev,
unsigned char *buff, size_t len);
int sysfs_get_asymmetric_access_state(struct path *pp,
char *buff, int buflen);
-bool has_uid_fallback(struct path *pp);
+bool can_recheck_wwid(const struct path *pp);
int get_uid(struct path * pp, int path_state, struct udev_device *udev,
int allow_fallback);
bool is_vpd_page_supported(int fd, int pg);
@@ -739,9 +739,7 @@ int select_recheck_wwid(struct config *conf, struct path * pp)
pp_set_conf(recheck_wwid);
pp_set_default(recheck_wwid, DEFAULT_RECHECK_WWID);
out:
- if (pp->recheck_wwid == RECHECK_WWID_ON &&
- (pp->bus != SYSFS_BUS_SCSI ||
- !has_uid_fallback(pp))) {
+ if (pp->recheck_wwid == RECHECK_WWID_ON && !can_recheck_wwid(pp)) {
pp->recheck_wwid = RECHECK_WWID_OFF;
origin = "(setting: unsupported by device type/config)";
}
Wrap some code from select_recheck_wwid() in a helper function. A future patch will call this code from a different function. Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> --- libmultipath/discovery.c | 12 +++++++++++- libmultipath/discovery.h | 2 +- libmultipath/propsel.c | 4 +--- 3 files changed, 13 insertions(+), 5 deletions(-)