vacuum: fix crash on vacuum abort
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 26 Jul 2010 06:38:07 +0000 (16:08 +0930)
committerMichael Adam <obnox@samba.org>
Thu, 12 Jan 2012 07:47:38 +0000 (08:47 +0100)
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>
(cherry picked from commit 8e518950ba281502318d6300f7a5ec6cdf6b5674)

server/ctdb_vacuum.c

index d4d0f66e3456a5ebc988c29740c6d8b02eb0f588..9ad4592f8bee26341c665a6de40355c269bd4f69 100644 (file)
@@ -958,6 +958,7 @@ static int ctdb_vacuum_and_repack_db(struct ctdb_db_context *ctdb_db,
        vdata->vacuum_limit = vacuum_limit;
        vdata->repack_limit = repack_limit;
        vdata->delete_tree = trbt_create(vdata, 0);
+       vdata->ctdb_db = ctdb_db;
        if (vdata->delete_tree == NULL) {
                DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
                talloc_free(vdata);
@@ -1234,9 +1235,9 @@ void ctdb_stop_vacuuming(struct ctdb_context *ctdb)
 {
        /* Simply free them all. */
        while (ctdb->vacuumers) {
-               DEBUG(DEBUG_INFO, ("Aborting vacuuming for %s (%p)\n",
+               DEBUG(DEBUG_INFO, ("Aborting vacuuming for %s (%i)\n",
                           ctdb->vacuumers->vacuum_handle->ctdb_db->db_name,
-                          ctdb->vacuumers->child_pid));
+                          (int)ctdb->vacuumers->child_pid));
                /* vacuum_child_destructor kills it, removes from list */
                talloc_free(ctdb->vacuumers);
        }