• Alex Elder's avatar
    rbd: fix module sysfs setup/teardown code · fed4c143
    Alex Elder authored
    Once rbd_bus_type is registered, it allows an "add" operation via
    the /sys/bus/rbd/add bus attribute, and adding a new rbd device that
    way establishes a connection between the device and rbd_root_dev.
    But rbd_root_dev is not registered until after the rbd_bus_type
    registration is complete.  This could (in principle anyway) result
    in an invalid state.
    
    Since rbd_root_dev has no tie to rbd_bus_type we can reorder these
    two initializations and never be faced with this scenario.
    
    In addition, unregister the device in the event the bus registration
    fails at module init time.
    Signed-off-by: default avatarAlex Elder <elder@dreamhost.com>
    Signed-off-by: default avatarSage Weil <sage@newdream.net>
    fed4c143
rbd.c 57.6 KB