diff mbox

[5/8] rbd: harden rbd_dev_refresh() caller

Message ID 1406191369-6746-6-git-send-email-ilya.dryomov@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ilya Dryomov July 24, 2014, 8:42 a.m. UTC
Recently discovered watch/notify problems showed that we really can't
ignore errors in anything refresh related.  Alas, currently there is
not much we can do in response to those errors, except print warnings.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
---
 drivers/block/rbd.c |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

Comments

Alex Elder July 24, 2014, 1:09 p.m. UTC | #1
On 07/24/2014 03:42 AM, Ilya Dryomov wrote:
> Recently discovered watch/notify problems showed that we really can't
> ignore errors in anything refresh related.  Alas, currently there is
> not much we can do in response to those errors, except print warnings.

Looks good.

Reviewed-by: Alex Elder <elder@linaro.org>


> 
> Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
> ---
>  drivers/block/rbd.c |   17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 23df1773ef77..5dd6f5057ef4 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2963,11 +2963,20 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data)
>  	dout("%s: \"%s\" notify_id %llu opcode %u\n", __func__,
>  		rbd_dev->header_name, (unsigned long long)notify_id,
>  		(unsigned int)opcode);
> +
> +	/*
> +	 * Until adequate refresh error handling is in place, there is
> +	 * not much we can do here, except warn.
> +	 *
> +	 * See http://tracker.ceph.com/issues/5040
> +	 */
>  	ret = rbd_dev_refresh(rbd_dev);
>  	if (ret)
> -		rbd_warn(rbd_dev, "header refresh error (%d)\n", ret);
> +		rbd_warn(rbd_dev, "refresh failed: %d\n", ret);
>  
> -	rbd_obj_notify_ack_sync(rbd_dev, notify_id);
> +	ret = rbd_obj_notify_ack_sync(rbd_dev, notify_id);
> +	if (ret)
> +		rbd_warn(rbd_dev, "notify_ack ret %d\n", ret);
>  }
>  
>  /*
> @@ -3724,9 +3733,9 @@ static ssize_t rbd_image_refresh(struct device *dev,
>  
>  	ret = rbd_dev_refresh(rbd_dev);
>  	if (ret)
> -		rbd_warn(rbd_dev, ": manual header refresh error (%d)\n", ret);
> +		return ret;
>  
> -	return ret < 0 ? ret : size;
> +	return size;
>  }
>  
>  static DEVICE_ATTR(size, S_IRUGO, rbd_size_show, NULL);
> 

--
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 23df1773ef77..5dd6f5057ef4 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2963,11 +2963,20 @@  static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data)
 	dout("%s: \"%s\" notify_id %llu opcode %u\n", __func__,
 		rbd_dev->header_name, (unsigned long long)notify_id,
 		(unsigned int)opcode);
+
+	/*
+	 * Until adequate refresh error handling is in place, there is
+	 * not much we can do here, except warn.
+	 *
+	 * See http://tracker.ceph.com/issues/5040
+	 */
 	ret = rbd_dev_refresh(rbd_dev);
 	if (ret)
-		rbd_warn(rbd_dev, "header refresh error (%d)\n", ret);
+		rbd_warn(rbd_dev, "refresh failed: %d\n", ret);
 
-	rbd_obj_notify_ack_sync(rbd_dev, notify_id);
+	ret = rbd_obj_notify_ack_sync(rbd_dev, notify_id);
+	if (ret)
+		rbd_warn(rbd_dev, "notify_ack ret %d\n", ret);
 }
 
 /*
@@ -3724,9 +3733,9 @@  static ssize_t rbd_image_refresh(struct device *dev,
 
 	ret = rbd_dev_refresh(rbd_dev);
 	if (ret)
-		rbd_warn(rbd_dev, ": manual header refresh error (%d)\n", ret);
+		return ret;
 
-	return ret < 0 ? ret : size;
+	return size;
 }
 
 static DEVICE_ATTR(size, S_IRUGO, rbd_size_show, NULL);