code: func (h *Handle) CheckConsistency() error {
  	for {
  		h.Lock()
  		store := h.store
  		h.Unlock()
  
  		if store != nil {
  			if err := store.GetObject(datastore.Key(h.Key()...), h); err != nil && err != datastore.ErrKeyNotFound {
  				return err
  			}
  		}
  
  		h.Lock()
  		nh := h.getCopy()
  		h.Unlock()
  
  		if !nh.runConsistencyCheck() {
  			return nil
  		}
  
  		if err := nh.writeToStore(); err != nil {
  			if _, ok := err.(types.RetryError); !ok {
  				return fmt.Errorf("internal failure while fixing inconsistent bitsequence: %v", err)
  			}
  			continue
  		}
  
  		logrus.Infof("Fixed inconsistent bit sequence in datastore:\n%s\n%s", h, nh)
  
  		h.Lock()
  		h.head = nh.head
  		h.Unlock()
  
  		return nil
  	}
  }
docs: // CheckConsistency checks if the bit sequence is in an inconsistent state and attempts to fix it.
  // It looks for a corruption signature that may happen in docker 1.9.0 and 1.9.1.