]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: fix clone issue when we specify image feature 6474/head
authorxinxin shu <xinxin.shu@intel.com>
Wed, 21 Oct 2015 06:56:17 +0000 (14:56 +0800)
committerNathan Cutler <ncutler@suse.com>
Thu, 5 Nov 2015 13:35:51 +0000 (14:35 +0100)
Fixes: #13553
Signed-off-by: xinxin shu <xinxin.shu@intel.com>
(cherry picked from commit da48dbb8f8c9417343d2ca7819c58b7c46ef7ad0)

src/rbd.cc

index ff9cf40064537554266130665c31250608cf8158..540579fbc7d4a1b56bcb9b61a636069f334143a1 100755 (executable)
@@ -3265,12 +3265,6 @@ int main(int argc, const char **argv)
     }
   }
 
-  if (features != 0 && !format_specified) {
-    format = 2;
-    format_specified = true;
-  } else if (features == 0) {
-    features = g_conf->rbd_default_features;
-  }
   if (shared) {
     features &= ~(RBD_FEATURE_EXCLUSIVE_LOCK | RBD_FEATURE_OBJECT_MAP);
   }
@@ -3405,8 +3399,13 @@ if (!set_conf_param(v, p1, p2, p3)) { \
 
   /* get defaults from rbd_default_* options to keep behavior consistent with
      manual short-form options */
-  if (!format_specified)
-    format = g_conf->rbd_default_format;
+  if (features != 0 && !format_specified) {
+    format = 2;
+  } else if (features == 0) {
+    features = g_conf->rbd_default_features;
+    if (!format_specified)
+      format = g_conf->rbd_default_format;
+  }
   if (!order)
     order = g_conf->rbd_default_order;
   if (!stripe_unit)
@@ -3582,6 +3581,10 @@ if (!set_conf_param(v, p1, p2, p3)) { \
     cerr << "rbd: clone must begin at size of parent" << std::endl;
     return EXIT_FAILURE;
   }
+  if ((opt_cmd == OPT_CLONE) &&
+      ((features & RBD_FEATURE_LAYERING) != RBD_FEATURE_LAYERING)) {
+    features |= RBD_FEATURE_LAYERING;
+  }
 
   if ((opt_cmd == OPT_RENAME) && (strcmp(poolname, dest_poolname) != 0)) {
     cerr << "rbd: mv/rename across pools not supported" << std::endl;