From: Sage Weil Date: Mon, 11 Feb 2013 00:59:48 +0000 (-0800) Subject: osd: unconditionally encode snaps buffer X-Git-Tag: v0.57~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=54b6dd924fea3af982f3d729150b6449f318daf2;p=ceph.git osd: unconditionally encode snaps buffer Previously we would only encode the updated snaps vector for CLONE ops. This doesn't work for MODIFY ops generated by the snap trimmer, which may also adjust the clone collections. It is also possible that other operations may need to populate this field in the future (e.g., LOST_REVERT may, although it currently does not). Fixes: #4071, and possibly #4051. Signed-off-by: Sage Weil Reviewed-by: Samuel Just --- diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 32e4d1582e61..07006bd1e0eb 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -1696,7 +1696,7 @@ void pg_query_t::generate_test_instances(list& o) void pg_log_entry_t::encode(bufferlist &bl) const { - ENCODE_START(6, 4, bl); + ENCODE_START(7, 4, bl); ::encode(op, bl); ::encode(soid, bl); ::encode(version, bl); @@ -1715,17 +1715,15 @@ void pg_log_entry_t::encode(bufferlist &bl) const ::encode(reqid, bl); ::encode(mtime, bl); - if (op == CLONE) - ::encode(snaps, bl); - if (op == LOST_REVERT) ::encode(prior_version, bl); + ::encode(snaps, bl); ENCODE_FINISH(bl); } void pg_log_entry_t::decode(bufferlist::iterator &bl) { - DECODE_START_LEGACY_COMPAT_LEN(5, 4, 4, bl); + DECODE_START_LEGACY_COMPAT_LEN(7, 4, 4, bl); ::decode(op, bl); if (struct_v < 2) { sobject_t old_soid; @@ -1747,8 +1745,6 @@ void pg_log_entry_t::decode(bufferlist::iterator &bl) ::decode(reqid, bl); ::decode(mtime, bl); - if (op == CLONE) - ::decode(snaps, bl); if (struct_v < 5) invalid_pool = true; @@ -1759,6 +1755,10 @@ void pg_log_entry_t::decode(bufferlist::iterator &bl) reverting_to = prior_version; } } + if (struct_v >= 7 || // for v >= 7, this is for all ops. + op == CLONE) { // for v < 7, it's only present for CLONE. + ::decode(snaps, bl); + } DECODE_FINISH(bl); }