vacuum: fix crash on vacuum abort
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 26 Jul 2010 06:38:07 +0000 (16:08 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 26 Jul 2010 06:38:07 +0000 (16:08 +0930)
Martin Schwenke discovered that 517f05e42f17766b1e8db8f1f4789cbad968e304
("freeze: abort vacuuming when we're going to freeze.") used ctdb_db for
a logging message which is in fact uninitialized, causing a crash (even
if it wasn't actually logged).

Initialize it properly.  Also fix incorrect format in another logging
message introduced in that same change.

CQ:S1019093
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
server/ctdb_vacuum.c

index 72d86555e401a1ec6d188d1a19d99caa61a9ffe9..91ea74fc5e4bd7bb188dae6d445721860dffb7ea 100644 (file)
@@ -660,6 +660,7 @@ static int ctdb_repack_db(struct ctdb_db_context *ctdb_db, int abortfd, TALLOC_C
        vdata->repack_limit = repack_limit;
        vdata->delete_tree = trbt_create(vdata, 0);
        vdata->abortfd = abortfd;
+       vdata->ctdb_db = ctdb_db;
        if (vdata->delete_tree == NULL) {
                DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
                talloc_free(vdata);
@@ -938,9 +939,9 @@ void ctdb_stop_vacuuming(struct ctdb_context *ctdb)
        /* FIXME: We don't just free them, since current TDB is not robust
         * against death during transaction commit. */
        for (i = ctdb->vacuumers; i; i = i->next) {
-               DEBUG(DEBUG_INFO, ("Aborting vacuuming for %s (%p)\n",
+               DEBUG(DEBUG_INFO, ("Aborting vacuuming for %s (%i)\n",
                                   i->vacuum_handle->ctdb_db->db_name,
-                                  i->child_pid));
+                                  (int)i->child_pid));
                write(i->abortfd[1], &c, 1);
        }
 }