git: HAMMER VFS - Correct seriuos bug in hammer rebalancing code

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Mar 2 15:05:32 PST 2010


commit bbb01e143edc616b0a7ea418ab3a82c6abb1700c
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Mar 2 14:36:40 2010 -0800

    HAMMER VFS - Correct seriuos bug in hammer rebalancing code
    
    * Correct a serious bug in the hammer rebalancing code which can cause
      incremental mirrors to lose track of records, resulting in missing records
      on the slave (missing files, missing directory entries, or files
      which improperly contain data holes).
    
      The rebalancing code needs to update the mirror_tid chain when moving
      elements from one node to another.  It updated the parent node but failed
      to update the internal element linkage pointing to the child.
    
      This can cause incremental mirroring operations to fail to copy some B-Tree
      records.
    
    * Correct a possible issue between the rebalancing code and B-Tree
      iterations during mirror-write operations.
    
      When the rebalancer moves an element from one child node to another and
      a cursor exists which is pointing at the parent internal node, the
      cursor will now be mispositioned because elements which were to the
      right of the cursor are now to the left of the cursor.
    
      Adjust hammer_cursor_moved_element() to properly move the cursor and
      print a debug message to the console so the code path can be tested.
    
    * These bugs are serious but also very rare.  There is a good chance that
      your slaves are just fine, but we recommend validating their contents
      anyway.
    
    * PROCEDURE FOR FIXING BROKEN SLAVES:  With a little help from the sysop
      these problems are self-correcting with the new kernel code in place.
    
      First make sure both the master and slave are running a kernel with
      the mirroring fix.
    
      Second, verify the slave matches the master (taking into account
      changes being made to live files).  Probably the easiest way to do
      this is as follows (make sure you push into the softlink, not cpdup
      the softlink itself):
    
    	cpdup -v -V /pfs/master/. /pfs/slave/.
    
      This should get you a list of missing files and directories.  For
      each missing file or directory do a chmod, chown, or chflags on the
      master, then change it back.  This will propagate the updated inode
      to the slave So for example:
    
    	chflags nodump file
    	chflags dump file
    
      If file data is corrupt on the mirroring slave you need to recopy the
      file on the master, which can be done with dd conv=notrunc:
    
    	dd if=file of=file bs=32k conv=notrunc
    
      These actions will cause the master to re-mirror the related files and
      data to the slave.
    
    Reported-by: Stathis Kamperis <beket at crater.dragonflybsd.org>

Summary of changes:
 sys/vfs/hammer/hammer.h           |    5 ++-
 sys/vfs/hammer/hammer_cursor.c    |   52 +++++++++++++++++++++++++++++++++---
 sys/vfs/hammer/hammer_mirror.c    |   12 +++++---
 sys/vfs/hammer/hammer_rebalance.c |   52 +++++++++++++++++++++++-------------
 4 files changed, 90 insertions(+), 31 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/bbb01e143edc616b0a7ea418ab3a82c6abb1700c


-- 
DragonFly BSD source repository





More information about the Commits mailing list