[multipathd] shut a libdevmapper error message when adding paths
authorroot <root@xa-s05.(none)>
Tue, 27 Sep 2005 13:25:09 +0000 (15:25 +0200)
committerroot <root@xa-s05.(none)>
Tue, 27 Sep 2005 13:25:09 +0000 (15:25 +0200)
"device-mapper ioctl cmd 12 failed: No such device or address" was
reported upon path add because we tried to submit a device-mapper ioctl
before the map is ready to receive it (and loop till it works or timeout).

shut the libdevmapper for this case with dm_init_log(&dummy_log) during
this operation.

libmultipath/devmapper.c
multipathd/main.c

index a0489f0..363b25f 100644 (file)
 #define MAX_WAIT 5
 #define LOOPS_PER_SEC 5
 
+static void
+dm_dummy_log (int level, const char *file, int line, const char *f, ...)
+{
+       return;
+}
+
+static void
+dm_restore_log (void)
+{
+       dm_log_init(NULL);
+}
+
+static void
+dm_shut_log (void)
+{
+       dm_log_init(&dm_dummy_log);
+}
+
 extern int
 dm_prereq (char * str, int x, int y, int z)
 {
@@ -616,10 +634,12 @@ dm_mapname(int major, int minor)
 
        /*
         * device map might not be ready when we get here from
-        * uevent trigger
+        * daemon uev_trigger -> uev_add_map
         */
        while (--loop) {
+               dm_shut_log();
                r = dm_task_run(dmt);
+               dm_restore_log();
 
                if (r)
                        break;
index 083bdf1..674f600 100644 (file)
@@ -1029,7 +1029,7 @@ mpvec_garbage_collector (struct vectors * vecs)
        int i;
 
        vector_foreach_slot (vecs->mpvec, mpp, i) {
-               if (!dm_map_present(mpp->alias)) {
+               if (mpp && mpp->alias && !dm_map_present(mpp->alias)) {
                        condlog(2, "%s: remove dead map", mpp->alias);
                        remove_map(mpp, vecs);
                        i--;