[PATCH V2 12/14] libmultipathpersist: use update_multipath_table/status in get_mpvec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The return values of dm_get_map, disassemble_map in get_mpvec
were not checked. Use update_multipath_table/status to instead
of them.

V1->V2: delete continue and add remove_map

Signed-off-by: Lixiaokeng <lixiaokeng@xxxxxxxxxx>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@xxxxxxxxxx>
Signed-off-by: Linfeilong <linfeilong@xxxxxxxxxx>
---
 libmpathpersist/mpath_persist.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index e7256049..1f9817ed 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -323,7 +323,6 @@ get_mpvec (vector curmp, vector pathvec, char * refwwid)
 {
        int i;
        struct multipath *mpp;
-       char params[PARAMS_SIZE], status[PARAMS_SIZE];

        vector_foreach_slot (curmp, mpp, i){
                /*
@@ -341,14 +340,12 @@ get_mpvec (vector curmp, vector pathvec, char * refwwid)
                if (refwwid && strncmp (mpp->alias, refwwid, WWID_SIZE - 1))
                        continue;

-               dm_get_map(mpp->alias, &mpp->size, params);
-               condlog(3, "params = %s", params);
-               dm_get_status(mpp->alias, status);
-               condlog(3, "status = %s", status);
-               disassemble_map (pathvec, params, mpp);
-               update_pathvec_from_dm(pathvec, mpp, DI_CHECKER);
-               disassemble_status (status, mpp);
-
+               if (update_multipath_table(mpp, pathvec, DI_CHECKER) != DMP_OK ||
+                   update_multipath_status(mpp) != DMP_OK) {
+                       condlog(1, "error parsing map %s", mpp->wwid);
+                       remove_map(mpp, pathvec, curmp, PURGE_VEC);
+                       i--;
+               }
        }
        return MPATH_PR_SUCCESS ;
 }
--


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux