]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rados: Add new field flags for ceph_osd_op.copy_get.
authorJianpeng Ma <jianpeng.ma@intel.com>
Mon, 20 Apr 2015 02:44:11 +0000 (10:44 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Mon, 20 Apr 2015 08:19:00 +0000 (16:19 +0800)
Using this field as the copy_get flags.
When using 'rados cp' copy a no-ec object w/ omap data into ecpool, it
will met this bug:
 osd/ReplicatedPG.cc: 6463: FAILED assert(cop->omap_header.length() == 0)

So we add CEPH_OSD_COPY_GET_FLAG_NOTSUPP_OMAP which avoid copy omap-object from
one pool to other.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/include/rados.h
src/osd/ReplicatedPG.cc
src/osdc/Objecter.h

index b2b8123329e975af8b8083cc2c8627cbe84542bc..424bef173b93263b55d05fb07bedb9318bf73d93 100644 (file)
@@ -448,6 +448,10 @@ enum {
                                                     * cloneid */
 };
 
+enum {
+       CEPH_OSD_COPY_GET_FLAG_NOTSUPP_OMAP = 1, /* mean dest pool don't support omap*/
+};
+
 enum {
        CEPH_OSD_TMAP2OMAP_NULLOK = 1,
 };
@@ -515,6 +519,7 @@ struct ceph_osd_op {
                } __attribute__ ((packed)) clonerange;
                struct {
                        __le64 max;     /* max data in reply */
+                       __le32 flags;
                } __attribute__ ((packed)) copy_get;
                struct {
                        __le64 snapid;
index 1f9bbb1580ccefb3801e254370e77e5b9c5a1dd1..0d5514b355d4e7da254dbd39e18365dceb486623 100644 (file)
@@ -6004,6 +6004,10 @@ int ReplicatedPG::fill_in_copy_get(
     return result;
   }
 
+  if ((osd_op.op.copy_get.flags & CEPH_OSD_COPY_GET_FLAG_NOTSUPP_OMAP) &&
+      oi.is_omap())
+      return -EOPNOTSUPP;
+
   MOSDOp *op = reinterpret_cast<MOSDOp*>(ctx->op->get_req());
   uint64_t features = op->get_features();
 
@@ -6215,7 +6219,12 @@ void ReplicatedPG::_copy_some(ObjectContextRef obc, CopyOpRef cop)
     // it already!
     assert(cop->cursor.is_initial());
   }
-  op.copy_get(&cop->cursor, get_copy_chunk_size(),
+
+  uint32_t copyget_flags = 0;
+  if (pool.info.require_rollback())
+   copyget_flags |= CEPH_OSD_COPY_GET_FLAG_NOTSUPP_OMAP;
+
+  op.copy_get(&cop->cursor, get_copy_chunk_size(), copyget_flags,
              &cop->results.object_size, &cop->results.mtime,
              &cop->attrs, &cop->data, &cop->omap_header, &cop->omap_data,
              &cop->results.snaps, &cop->results.snap_seq,
index bfc61f556e7be4ea457f0ef29fba870835e23fb4..478c16661b45a994444ee628d303a4253e9a62e9 100644 (file)
@@ -694,6 +694,7 @@ struct ObjectOperation {
 
   void copy_get(object_copy_cursor_t *cursor,
                uint64_t max,
+               uint32_t copyget_flags,
                uint64_t *out_size,
                utime_t *out_mtime,
                std::map<std::string,bufferlist> *out_attrs,
@@ -709,6 +710,7 @@ struct ObjectOperation {
                int *prval) {
     OSDOp& osd_op = add_op(CEPH_OSD_OP_COPY_GET);
     osd_op.op.copy_get.max = max;
+    osd_op.op.copy_get.flags = copyget_flags;
     ::encode(*cursor, osd_op.indata);
     ::encode(max, osd_op.indata);
     unsigned p = ops.size() - 1;