• Alex Elder's avatar
    rbd: update capacity in rbd_dev_refresh() · 00a653e2
    Alex Elder authored
    When a mapped image changes size, we change the capacity recorded
    for the Linux disk associated with it, in rbd_update_mapping_size().
    That function is called in two places--the format 1 and format 2
    refresh routines.
    
    There is no need to set the capacity while holding the header
    semaphore.  Instead, do it in the common rbd_dev_refresh(), using
    the logic that's already there to initiate disk revalidation.
    
    Add handling in the request function, just in case a request
    that exceeds the capacity of the device comes in (perhaps one
    that was started before a refresh shrunk the device).
    Signed-off-by: default avatarAlex Elder <elder@inktank.com>
    Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
    00a653e2
rbd.c 130 KB