• Alex Elder's avatar
    rbd: define rbd_dev_unprobe() · 6fd48b3b
    Alex Elder authored
    Define a new function rbd_dev_unprobe() which undoes state changes
    that occur from calling rbd_dev_v1_probe() or rbd_dev_v2_probe().
    Note that this is a superset of rbd_header_free(), which is now
    getting removed (it seems to have been used improperly anyway).
    
    Flesh out rbd_dev_image_release() so it undoes exactly what
    rbd_dev_image_probe() does.
    
    This means that:
        - rbd_dev_device_release() gets called when the last device
          reference gets dropped;
        - that undoes everything done by the rbd_dev_device_setup() call
          at the end of rbd_dev_image_probe() (and nothing more), ending
          by calling rbd_dev_image_release(); and
        - rbd_dev_image_release() undoes everything else done by
          rbd_dev_image_probe() (and this includes a call to
          rbd_dev_unprobe().
    
    This means the image and device portions of an rbd device are fairly
    cleanly separated now, so error paths should be a little easier to
    verify than they used to be.
    Signed-off-by: default avatarAlex Elder <elder@inktank.com>
    Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
    6fd48b3b
rbd.c 130 KB