diff mbox

[9/9] rbd: set up watch before announcing disk

Message ID 504A169F.3070604@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder Sept. 7, 2012, 3:45 p.m. UTC
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>
---
 drivers/block/rbd.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Josh Durgin Sept. 11, 2012, 3:08 p.m. UTC | #1
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 09/07/2012 08:45 AM, Alex Elder wrote:
> 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>
> ---
>   drivers/block/rbd.c |   10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 51e1d21..daa428e3 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2640,23 +2640,23 @@ static ssize_t rbd_add(struct bus_type *bus,
>   	if (rc)
>   		goto err_out_unlock;
>
> +	rc = rbd_init_watch_dev(rbd_dev);
> +	if (rc)
> +		goto err_out_unlock;
> +
>   	up_write(&rbd_dev->header_rwsem);
>
>   	/* 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_unlock:
>   	up_write(&rbd_dev->header_rwsem);
> -err_out_bus:
>   	/* this will also clean up rest of rbd_dev stuff */
>
>   	rbd_bus_del_dev(rbd_dev);
>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 51e1d21..daa428e3 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2640,23 +2640,23 @@  static ssize_t rbd_add(struct bus_type *bus,
 	if (rc)
 		goto err_out_unlock;

+	rc = rbd_init_watch_dev(rbd_dev);
+	if (rc)
+		goto err_out_unlock;
+
 	up_write(&rbd_dev->header_rwsem);

 	/* 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_unlock:
 	up_write(&rbd_dev->header_rwsem);
-err_out_bus:
 	/* this will also clean up rest of rbd_dev stuff */

 	rbd_bus_del_dev(rbd_dev);