]> git.baikalelectronics.ru Git - kernel.git/commit
rbd: fix module sysfs setup/teardown code
authorAlex Elder <elder@dreamhost.com>
Tue, 7 Feb 2012 18:03:36 +0000 (12:03 -0600)
committerAlex Elder <elder@dreamhost.com>
Thu, 22 Mar 2012 15:47:50 +0000 (10:47 -0500)
commit9f7b4dd333956eaea4366d8e7db88cd9d2b3f5f6
tree2c4e649eaa7ea7a73fa29d603c019d7df7fa287a
parent9cfcb7d13c2e8452f094a97b22ac6759456177a9
rbd: fix module sysfs setup/teardown code

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: Alex Elder <elder@dreamhost.com>
Signed-off-by: Sage Weil <sage@newdream.net>
drivers/block/rbd.c