HAMMER VFS - Fix assertion with multi-volume setup
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 1 Apr 2012 01:35:33 +0000 (18:35 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 1 Apr 2012 01:35:33 +0000 (18:35 -0700)
* The RB compare code for hammer_io was extracting the volume number
  from the wrong place, creating a situation where duplicate hammer_io's
  would sometimes be inserted in the RB tree (causing an assertion + panic).

* Pull the volume number from a different field.

Reported-by: Mark Saad <nonesuch@longcount.org>
sys/vfs/hammer/hammer_io.c

index b32b115..db1d149 100644 (file)
@@ -73,9 +73,9 @@ hammer_mod_rb_compare(hammer_io_t io1, hammer_io_t io2)
        hammer_off_t io2_offset;
 
        io1_offset = ((io1->offset & HAMMER_OFF_SHORT_MASK) << 8) |
-                    HAMMER_VOL_DECODE(io1->offset);
+                    io1->volume->vol_no;
        io2_offset = ((io2->offset & HAMMER_OFF_SHORT_MASK) << 8) |
-                    HAMMER_VOL_DECODE(io2->offset);
+                    io2->volume->vol_no;
 
        if (io1_offset < io2_offset)
                return(-1);