diff mbox

[1/2] rbd: return the features to caller even if there is unsupported bits

Message ID 1521541939-15932-2-git-send-email-dongsheng.yang@easystack.cn (mailing list archive)
State New, archived
Headers show

Commit Message

Dongsheng Yang March 20, 2018, 10:32 a.m. UTC
When we are doing features refresh, we need to get the features even if
there are some features unsupported enabled after rbd map.

Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
---
 drivers/block/rbd.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index f1d9e60..eb59b93 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4446,13 +4446,6 @@  static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id,
 	if (ret < sizeof (features_buf))
 		return -ERANGE;
 
-	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);
 
 	dout("  snap_id 0x%016llx features = 0x%016llx incompat = 0x%016llx\n",
@@ -4460,13 +4453,25 @@  static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id,
 		(unsigned long long)*snap_features,
 		(unsigned long long)le64_to_cpu(features_buf.incompat));
 
+	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;
+	}
+
 	return 0;
 }
 
 static int rbd_dev_v2_features(struct rbd_device *rbd_dev)
 {
-	return _rbd_dev_v2_snap_features(rbd_dev, CEPH_NOSNAP,
-						&rbd_dev->header.features);
+	u64 features = 0;
+	int ret = _rbd_dev_v2_snap_features(rbd_dev, CEPH_NOSNAP, features);
+	if (ret)
+		return ret
+
+	rbd_dev->header.features = features
+	return 0;
 }
 
 static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)