• Ilya Dryomov's avatar
    rbd: do not read in parent info before snap context · e8f59b59
    Ilya Dryomov authored
    Currently rbd_dev_v2_header_info() reads in parent info before the snap
    context is read in.  This is wrong, because we may need to look at the
    the parent_overlap value of the snapshot instead of that of the base
    image, for example when mapping a snapshot - see next commit.  (When
    mapping a snapshot, all we got is its name and we need the snap context
    to translate that name into an id to know which parent info to look
    for.)
    
    The approach taken here is to make sure rbd_dev_v2_parent_info() is
    called after the snap context has been read in.  The other approach
    would be to add a parent_overlap field to struct rbd_mapping and
    maintain it the same way rbd_mapping::size is maintained.  The reason
    I chose the first approach is that the value of keeping around both
    base image values and the actual mapping values is unclear to me.
    Signed-off-by: default avatarIlya Dryomov <ilya.dryomov@inktank.com>
    Reviewed-by: default avatarAlex Elder <elder@linaro.org>
    e8f59b59
rbd.c 141 KB