diff options
author | Sage Weil <sage@inktank.com> | 2013-02-10 16:59:48 -0800 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2013-03-19 10:30:07 -0700 |
commit | f0bf68ff500f7337103aef2a9d6d10c3597e410f (patch) | |
tree | 61d03977954c263cb2d6c47d16167f30aad11343 | |
parent | aa74fabd90b776e9938f3d59ea5ed04bd4027dbb (diff) | |
download | ceph-f0bf68ff500f7337103aef2a9d6d10c3597e410f.tar.gz |
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 <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 54b6dd924fea3af982f3d729150b6449f318daf2)
-rw-r--r-- | src/osd/osd_types.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index ce28235ee9f..c8aea95c269 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -1694,7 +1694,7 @@ void pg_query_t::generate_test_instances(list<pg_query_t*>& 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); @@ -1713,17 +1713,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; @@ -1745,8 +1743,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; @@ -1757,6 +1753,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); } |