From: Jianpeng Ma Date: Mon, 20 Apr 2015 02:44:11 +0000 (+0800) Subject: rados: Add new field flags for ceph_osd_op.copy_get. X-Git-Tag: v9.0.1~40^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2b4acfb1b808b98132a771cf1089063c0f7a75b5;p=ceph.git rados: Add new field flags for ceph_osd_op.copy_get. 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 --- diff --git a/src/include/rados.h b/src/include/rados.h index b2b8123329e9..424bef173b93 100644 --- a/src/include/rados.h +++ b/src/include/rados.h @@ -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; diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 1f9bbb1580cc..0d5514b355d4 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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(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, diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index bfc61f556e7b..478c16661b45 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -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 *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;