Check return code from pathinfo()
authorHannes Reinecke <hare@suse.de>
Tue, 8 Jan 2013 13:53:56 +0000 (14:53 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Tue, 8 Jan 2013 22:39:28 +0000 (23:39 +0100)
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@suse.de>
libmultipath/discovery.c
libmultipath/structs_vec.c

index e328332..b5df8e3 100644 (file)
@@ -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))
index d914435..6d36d58 100644 (file)
@@ -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;