diff mbox

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

Message ID 1525682645-30510-3-git-send-email-dongsheng.yang@easystack.cn (mailing list archive)
State New, archived
Headers show

Commit Message

Dongsheng Yang May 7, 2018, 8:43 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 d56c250..a1a4bbe 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4544,13 +4544,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",
@@ -4558,13 +4551,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)