dm_flush_maps() returned both 0 and 1 on error, depending on which part
of the function it was in, but the caller was always treating 0 as a
success. Make dm_flush_maps() always return 1 on error and 0 on success.

Reviewed-by: Martin Wilck <mwi...@suse.com>
Signed-off-by: Benjamin Marzinski <bmarz...@redhat.com>
---
 libmultipath/devmapper.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index f5cfe296..b799634a 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -1007,13 +1007,13 @@ dm_flush_map_nopaths(const char * mapname, int 
deferred_remove)
 
 int dm_flush_maps (int retries)
 {
-       int r = 0;
+       int r = 1;
        struct dm_task *dmt;
        struct dm_names *names;
        unsigned next = 0;
 
        if (!(dmt = libmp_dm_task_create (DM_DEVICE_LIST)))
-               return 0;
+               return r;
 
        dm_task_no_open_count(dmt);
 
@@ -1026,6 +1026,7 @@ int dm_flush_maps (int retries)
        if (!names->dev)
                goto out;
 
+       r = 0;
        do {
                r |= dm_suspend_and_flush_map(names->name, retries);
                next = names->next;
-- 
2.17.2

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

Reply via email to