On Sat, 2019-03-30 at 01:06 -0500, Benjamin Marzinski wrote: > Instead of always calling uid_fallback() if the configured method to > get > the uid failed, get_uid now checks if the path supports fallbacks and > if > all the retriggers have occurred. If so, it calls uid_fallback(), > which > just attempts to get the uid using the appropriate fallback method. > None > of these changes should make the code function any differently. > > Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> > --- > libmultipath/discovery.c | 85 ++++++++++++++++++++++-------------- > ---- > 1 file changed, 46 insertions(+), 39 deletions(-) > > diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c > index bece67c..3ec60d6 100644 > --- a/libmultipath/discovery.c > +++ b/libmultipath/discovery.c > @@ -1755,50 +1755,50 @@ get_vpd_uid(struct path * pp) > } > > static ssize_t uid_fallback(struct path *pp, int path_state, > - const char **origin, ssize_t old_len) > + const char **origin) > { > - ssize_t len = old_len; > - int retrigger; > - struct config *conf; > - > - conf = get_multipath_config(); > - retrigger = conf->retrigger_tries; > - put_multipath_config(conf); > - if (pp->retriggers >= retrigger) { > - if (pp->bus == SYSFS_BUS_SCSI && > - !strcmp(pp->uid_attribute, DEFAULT_UID_ATTRIBUTE)) > { > - len = get_vpd_uid(pp); > - *origin = "sysfs"; > - pp->uid_attribute = NULL; > - if (len < 0 && path_state == PATH_UP) { > - condlog(1, "%s: failed to get sysfs > uid: %s", > - pp->dev, strerror(-len)); > - len = get_vpd_sgio(pp->fd, 0x83, pp- > >wwid, > + ssize_t len = -1; > + > + if (pp->bus == SYSFS_BUS_SCSI && > + !strcmp(pp->uid_attribute, DEFAULT_UID_ATTRIBUTE)) { Even the check for DEFAULT_UID_ATTRIBUTE might be moved to get_uid(). But we can do that later. Reviewed-by: Martin Wilck <mwilck@xxxxxxxx> -- Dr. Martin Wilck <mwilck@xxxxxxxx>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel