[dm-devel] [PATCH 18/42] Check return code from pathinfo()

Hannes Reinecke hare at suse.de
Tue Jan 8 13:53:56 UTC 2013


Pathinfo might fail, which indicates that the path is not
available anymore. So check the return value and take
appropriate action.

Signed-off-by: Hannes Reinecke <hare at suse.de>
---
 libmultipath/discovery.c   |    2 +-
 libmultipath/structs_vec.c |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index e328332..b5df8e3 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -680,7 +680,7 @@ path_offline (struct path * pp)
 	return PATH_DOWN;
 }
 
-extern int
+int
 sysfs_pathinfo(struct path * pp)
 {
 	if (common_sysfs_pathinfo(pp))
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index d914435..6d36d58 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -68,9 +68,9 @@ adopt_paths (vector pathvec, struct multipath * mpp, int get_info)
 			if (!find_path_by_dev(mpp->paths, pp->dev) &&
 			    store_path(mpp->paths, pp))
 					return 1;
-			if (get_info)
-				pathinfo(pp, conf->hwtable,
-					 DI_PRIO | DI_CHECKER);
+			if (get_info && pathinfo(pp, conf->hwtable,
+						 DI_PRIO | DI_CHECKER))
+				return 1;
 		}
 	}
 	return 0;
-- 
1.7.4.2




More information about the dm-devel mailing list