--- libmultipath/discovery.c | 18 ++++++++++++++---- libmultipath/discovery.h | 1 + libmultipath/structs_vec.c | 3 +-- multipathd/main.c | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) Index: multipath-597789/libmultipath/discovery.c =================================================================== --- multipath-597789.orig/libmultipath/discovery.c +++ multipath-597789/libmultipath/discovery.c @@ -162,6 +162,19 @@ out: return r; } +int +check_sysfs_dir(char *sysfs_path, char * dev) +{ + char dev_dir[SYSFS_PATH_SIZE]; + struct stat stats; + + if (sysfs_path && safe_sprintf(dev_dir, "%s/block/%s", sysfs_path, dev)) + return 1; + if (stat(dev_dir, &stats) != 0) + return 1; + return 0; +} + /* * the daemon can race udev upon path add, * not multipath(8), ran by udev @@ -175,10 +188,7 @@ wait_for_file (char * filename, char * s { int loop; struct stat stats; - char dev_dir[SYSFS_PATH_SIZE]; - if (sysfs_path && safe_sprintf(dev_dir, "%s/block/%s", sysfs_path, dev)) - return 1; loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; while (--loop) { @@ -188,7 +198,7 @@ wait_for_file (char * filename, char * s if (errno != ENOENT) return 1; - if (sysfs_path && stat(dev_dir, &stats) != 0) + if (sysfs_path && check_sysfs_dir(sysfs_path, dev) != 0) return 1; usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); Index: multipath-597789/libmultipath/discovery.h =================================================================== --- multipath-597789.orig/libmultipath/discovery.h +++ multipath-597789/libmultipath/discovery.h @@ -24,6 +24,7 @@ #define SCSI_COMMAND_TERMINATED 0x22 #define SG_ERR_DRIVER_SENSE 0x08 +int check_sysfs_dir(char *sysfs_path, char * dev); int device_ok_to_add(char *devname); int sysfs_get_vendor (char * sysfs_path, char * dev, char * buff, int len); int sysfs_get_model (char * sysfs_path, char * dev, char * buff, int len); Index: multipath-597789/libmultipath/structs_vec.c =================================================================== --- multipath-597789.orig/libmultipath/structs_vec.c +++ multipath-597789/libmultipath/structs_vec.c @@ -378,8 +378,7 @@ verify_paths(struct multipath * mpp, str * see if path is in sysfs */ if (!(*pp->dev) || - sysfs_get_dev(sysfs_path, pp->dev, pp->dev_t, - BLK_DEV_SIZE)) { + check_sysfs_dir(sysfs_path, pp->dev)) { if (!(*pp->dev)) condlog(3, "%s: removing path %s with no devname", Index: multipath-597789/multipathd/main.c =================================================================== --- multipath-597789.orig/multipathd/main.c +++ multipath-597789/multipathd/main.c @@ -411,8 +411,8 @@ rescan: if (adopt_paths(vecs->pathvec, mpp)) return 1; /* leave path added to pathvec */ - verify_paths(mpp, vecs, NULL); mpp->hwe = pp->hwe; + verify_paths(mpp, vecs, NULL); mpp->flush_on_last_del = FLUSH_UNDEF; mpp->action = ACT_RELOAD; }