diff mbox

rbd: report unsupported features to syslog

Message ID 1460748345-3717-1-git-send-email-idryomov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ilya Dryomov April 15, 2016, 7:25 p.m. UTC
... instead of just returning an error.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
---
 drivers/block/rbd.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Josh Durgin April 27, 2016, 9:14 p.m. UTC | #1
On 04/15/2016 12:25 PM, Ilya Dryomov wrote:
> ... instead of just returning an error.
>
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

Reviewed-by: Josh Durgin <jdurgin@redhat.com>

> ---
>   drivers/block/rbd.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 9f1eb00b5e64..78aca585e7e5 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -4184,7 +4184,7 @@ static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id,
>   		__le64 features;
>   		__le64 incompat;
>   	} __attribute__ ((packed)) features_buf = { 0 };
> -	u64 incompat;
> +	u64 unsup;
>   	int ret;
>
>   	ret = rbd_obj_method_sync(rbd_dev, rbd_dev->header_name,
> @@ -4197,9 +4197,12 @@ static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id,
>   	if (ret < sizeof (features_buf))
>   		return -ERANGE;
>
> -	incompat = le64_to_cpu(features_buf.incompat);
> -	if (incompat & ~RBD_FEATURES_SUPPORTED)
> +	unsup = le64_to_cpu(features_buf.incompat) & ~RBD_FEATURES_SUPPORTED;
> +	if (unsup) {
> +		rbd_warn(rbd_dev, "image uses unsupported features: 0x%llx",
> +			 unsup);
>   		return -ENXIO;
> +	}
>
>   	*snap_features = le64_to_cpu(features_buf.features);
>
>

--
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
Douglas Fuller April 28, 2016, 4:42 p.m. UTC | #2
Looks good to me.

Reviewed-by: Douglas Fuller <dfuller@redhat.com>

Cheers,
—Doug

> On Apr 15, 2016, at 3:25 PM, Ilya Dryomov <idryomov@gmail.com> wrote:
> 
> ... instead of just returning an error.
> 
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
> ---
> drivers/block/rbd.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 9f1eb00b5e64..78aca585e7e5 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -4184,7 +4184,7 @@ static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id,
> 		__le64 features;
> 		__le64 incompat;
> 	} __attribute__ ((packed)) features_buf = { 0 };
> -	u64 incompat;
> +	u64 unsup;
> 	int ret;
> 
> 	ret = rbd_obj_method_sync(rbd_dev, rbd_dev->header_name,
> @@ -4197,9 +4197,12 @@ static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id,
> 	if (ret < sizeof (features_buf))
> 		return -ERANGE;
> 
> -	incompat = le64_to_cpu(features_buf.incompat);
> -	if (incompat & ~RBD_FEATURES_SUPPORTED)
> +	unsup = le64_to_cpu(features_buf.incompat) & ~RBD_FEATURES_SUPPORTED;
> +	if (unsup) {
> +		rbd_warn(rbd_dev, "image uses unsupported features: 0x%llx",
> +			 unsup);
> 		return -ENXIO;
> +	}
> 
> 	*snap_features = le64_to_cpu(features_buf.features);
> 
> -- 
> 2.4.3
> 
> --
> 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

--
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 9f1eb00b5e64..78aca585e7e5 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4184,7 +4184,7 @@  static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id,
 		__le64 features;
 		__le64 incompat;
 	} __attribute__ ((packed)) features_buf = { 0 };
-	u64 incompat;
+	u64 unsup;
 	int ret;
 
 	ret = rbd_obj_method_sync(rbd_dev, rbd_dev->header_name,
@@ -4197,9 +4197,12 @@  static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id,
 	if (ret < sizeof (features_buf))
 		return -ERANGE;
 
-	incompat = le64_to_cpu(features_buf.incompat);
-	if (incompat & ~RBD_FEATURES_SUPPORTED)
+	unsup = le64_to_cpu(features_buf.incompat) & ~RBD_FEATURES_SUPPORTED;
+	if (unsup) {
+		rbd_warn(rbd_dev, "image uses unsupported features: 0x%llx",
+			 unsup);
 		return -ENXIO;
+	}
 
 	*snap_features = le64_to_cpu(features_buf.features);