• Iustin Pop's avatar
    drbd: change the semantics of Attach vs. Assemble · 2d0c8319
    Iustin Pop authored
    Currently, both the Attach and Assemble methods for DRBD8 devices will use and
    alter the device state. This is suboptimal, and it has been worked
    around in 1.2 via a special cache in the node daemon so that we don't
    need to call Attach() again in migration, for example.
    
    Since in 2.0 we have static minors, we can change these functions so
    that:
      - Attach() does not affect the device in any way, and only checks if
        the minor is already in use or not
      - Assemble() has two logic paths, one for startup from unused minor
        (the old Assemble, now renamed _FastAssemble) and one for
        re-checking/fixing an in-use minor (the old Attach, now renamed
        _SlowAttach)
    
    Basically Attach was renamed to _SlowAttach, Assemble to _FastAssemble,
    and we have a new, simple Assemble that calls one or the other based on
    the result of the new Attach.
    
    The LUReplaceDisks (with new secondary) is relying on the special
    semantics of Attach modifying the device and is broken until the end of
    the patch series.
    
    Reviewed-by: ultrotter
    2d0c8319
bdev.py 54.1 KB