]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: unconditionally encode snaps buffer
authorSage Weil <sage@inktank.com>
Mon, 11 Feb 2013 00:59:48 +0000 (16:59 -0800)
committerSage Weil <sage@inktank.com>
Mon, 11 Feb 2013 21:24:48 +0000 (13:24 -0800)
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>
src/osd/osd_types.cc

index 32e4d1582e61148533a11fbf7e45d380fd412dc2..07006bd1e0ebc5597d6037090352bdc20988c14e 100644 (file)
@@ -1696,7 +1696,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);
@@ -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);
 }