sys/vfs/hammer: Fix possible panic with vfs.hammer.debug_general=0x4000
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sun, 23 Aug 2015 10:53:33 +0000 (19:53 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sun, 23 Aug 2015 11:19:26 +0000 (20:19 +0900)
bc996e6 needed to check NULL-elm case for node reblock
when (vfs.hammer.debug_general & 0x4000) != 0.

The above sysctl has 0 by default, so nothing will happen
as long as keeping a default value when reblock starts.

sys/vfs/hammer/hammer_reblock.c

index 0b16f5d..bba71d4 100644 (file)
@@ -491,7 +491,7 @@ hammer_reblock_data(struct hammer_ioc_reblock *reblock,
 
        if (hammer_debug_general & 0x4000) {
                kprintf("REBLOCK DATA %08x %016llx -> %016llx\n",
-                       elm->base.localization,
+                       (elm ? elm->base.localization : -1),
                        (long long)odata_offset,
                        (long long)ndata_offset);
        }
@@ -542,7 +542,7 @@ hammer_reblock_leaf_node(struct hammer_ioc_reblock *reblock,
        if (hammer_debug_general & 0x4000) {
                kprintf("REBLOCK %cNODE %08x %016llx -> %016llx\n",
                        nnode->ondisk->type,
-                       elm->base.localization,
+                       (elm ? elm->base.localization : -1),
                        (long long)onode->node_offset,
                        (long long)nnode->node_offset);
        }
@@ -603,7 +603,7 @@ hammer_reblock_int_node(struct hammer_ioc_reblock *reblock,
        if (hammer_debug_general & 0x4000) {
                kprintf("REBLOCK %cNODE %08x %016llx -> %016llx\n",
                        nnode->ondisk->type,
-                       elm->base.localization,
+                       (elm ? elm->base.localization : -1),
                        (long long)onode->node_offset,
                        (long long)nnode->node_offset);
        }