From 8a72de3e881a355b9b21dcc01983b6bedc5f970b Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Sun, 9 Mar 2014 11:43:57 -0700 Subject: [PATCH] ReplicatedPG: adjust pending_attrs correctly in copy_from Otherwise, subsequent reads might not get the correct cached attrs. Fixes: #7663 Signed-off-by: Samuel Just --- src/osd/ReplicatedPG.cc | 5 ++++- src/osd/ReplicatedPG.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 2d8d60bf13c..8040cb4db4d 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -5537,10 +5537,12 @@ void ReplicatedPG::_write_copy_chunk(CopyOpRef cop, PGBackend::PGTransaction *t) t->touch(cop->results.temp_oid); for (map::iterator p = cop->attrs.begin(); p != cop->attrs.end(); - ++p) + ++p) { + cop->results.attrs[string("_") + p->first] = p->second; t->setattr( cop->results.temp_oid, string("_") + p->first, p->second); + } cop->attrs.clear(); } if (!cop->temp_cursor.data_complete) { @@ -5620,6 +5622,7 @@ void ReplicatedPG::finish_copyfrom(OpContext *ctx) } } ctx->mod_desc.create(); + replace_cached_attrs(ctx, ctx->obc, cb->results->attrs); } else { if (obs.exists) { ctx->op_t->remove(obs.oi.soid); diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 969a094e74c..1c9bf24db41 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -122,6 +122,7 @@ public: snapid_t snap_seq; ///< src's snap_seq (if head) librados::snap_set_t snapset; ///< src snapset (if head) bool mirror_snapset; + map attrs; ///< src user attrs CopyResults() : object_size(0), started_temp_obj(false), user_version(0), should_requeue(false), mirror_snapset(false) {} -- 2.47.3