diff mbox

multipath-tools libmultipath/configure.c libmu ...

Message ID 20100623162810.7501.qmail@sourceware.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

bmarzins@sourceware.org June 23, 2010, 4:28 p.m. UTC
None
diff mbox

Patch

--- multipath-tools/libmultipath/configure.c	2010/04/24 05:28:06	1.2.2.8
+++ multipath-tools/libmultipath/configure.c	2010/06/23 16:28:07	1.2.2.9
@@ -177,8 +177,8 @@ 
 		return;
 	}
 	if (cmpp->size != mpp->size) {
-		mpp->action = ACT_RELOAD;
-		condlog(3, "%s: set ACT_RELOAD (size change)",
+		mpp->action = ACT_RESIZE;
+		condlog(3, "%s: set ACT_RESIZE (size change)",
 			mpp->alias);
 		return;
 	}
@@ -463,6 +463,7 @@ 
 			strerror(errno));
 		return -1;
 	}
+	close(fd);
 	if (lock.l_type == F_UNLCK)
 		return 0;
 	return 1;
--- multipath-tools/libmultipath/discovery.c	2010/01/27 22:33:29	1.32.2.13
+++ multipath-tools/libmultipath/discovery.c	2010/06/23 16:28:07	1.32.2.14
@@ -162,6 +162,19 @@ 
 	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
@@ -171,11 +184,11 @@ 
 #define WAIT_LOOP_PER_SECOND 5
 
 static int
-wait_for_file (char * filename)
+wait_for_file (char * filename, char * sysfs_path, char * dev)
 {
 	int loop;
 	struct stat stats;
-	
+
 	loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND;
 	
 	while (--loop) {
@@ -185,13 +198,16 @@ 
 		if (errno != ENOENT)
 			return 1;
 
+		if (sysfs_path && check_sysfs_dir(sysfs_path, dev) != 0)
+			return 1;
+
 		usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND);
 	}
 	return 1;
 }
 #else
 static int
-wait_for_file (char * filename)
+wait_for_file (char * filename, char * sysfs_path, char * dev)
 {
 	return 0;
 }
@@ -207,7 +223,7 @@ 
 	if (safe_sprintf(attr_path, fmt, sysfs_path, dev)) \
 		return 1; \
 \
-	if (dowait && wait_for_file(attr_path)) \
+	if (dowait && wait_for_file(attr_path, sysfs_path, dev)) \
 		return 1; \
 \
 	if (!(attr = sysfs_open_attribute(attr_path))) \
@@ -320,7 +336,7 @@ 
 		return -1;
 	}
 
-	if (wait_for_file(devpath)) {
+	if (wait_for_file(devpath, NULL, NULL)) {
 		condlog(3, "failed to open %s", devpath);
 		return -1;
 	}
@@ -857,6 +873,8 @@ 
 		get_prio(pp);
 
 #ifndef DAEMON
+	if (checker_selected(&pp->checker))
+		checker_put(&pp->checker);
 	close(pp->fd);
 	pp->fd = -1;
 #endif
--- multipath-tools/libmultipath/discovery.h	2010/01/27 16:46:48	1.14.2.3
+++ multipath-tools/libmultipath/discovery.h	2010/06/23 16:28:07	1.14.2.4
@@ -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);
--- multipath-tools/libmultipath/structs_vec.c	2009/03/26 03:28:09	1.1.2.4
+++ multipath-tools/libmultipath/structs_vec.c	2010/06/23 16:28:07	1.1.2.5
@@ -378,8 +378,7 @@ 
 		 * 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",
--- multipath-tools/multipathd/main.c	2010/01/27 17:21:48	1.69.2.26
+++ multipath-tools/multipathd/main.c	2010/06/23 16:28:08	1.69.2.27
@@ -411,8 +411,8 @@ 
 		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;
 	}