rbd: set up watch before announcing disk
authorAlex Elder <elder@inktank.com>
Wed, 29 Aug 2012 22:11:07 +0000 (17:11 -0500)
committerAlex Elder <elder@inktank.com>
Mon, 1 Oct 2012 19:30:52 +0000 (14:30 -0500)
We're ready to handle header object (refresh) events at the point we
call rbd_bus_add_dev().  Set up the watch request on the rbd image
header just after that, and after we've registered the devices for
the snapshots for the initial snapshot context.  Do this before
announce the disk as available for use.

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
drivers/block/rbd.c

index 3274943..61807c3 100644 (file)
@@ -2646,16 +2646,17 @@ static ssize_t rbd_add(struct bus_type *bus,
        if (rc)
                goto err_out_bus;
 
+       rc = rbd_init_watch_dev(rbd_dev);
+       if (rc)
+               goto err_out_bus;
+
        /* Everything's ready.  Announce the disk to the world. */
 
        add_disk(rbd_dev->disk);
+
        pr_info("%s: added with size 0x%llx\n", rbd_dev->disk->disk_name,
                (unsigned long long) rbd_dev->mapping.size);
 
-       rc = rbd_init_watch_dev(rbd_dev);
-       if (rc)
-               goto err_out_bus;
-
        return count;
 
 err_out_bus: