]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG::recover_backfill: adjust last_backfill to HEAD if snapdir
authorSamuel Just <sam.just@inktank.com>
Sat, 2 Nov 2013 20:54:51 +0000 (13:54 -0700)
committerSamuel Just <sam.just@inktank.com>
Mon, 4 Nov 2013 19:08:19 +0000 (11:08 -0800)
Otherwise, if last_backfill_started is a snapdir, we will fail to send a
transaction for a client IO creating the head object and removing the
snapdir object.  The result will be that head will eventually be
backfilled, but the snapdir object will erroneously not be removed.

Fixes: #6685
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/common/hobject.h
src/osd/ReplicatedPG.cc

index edaf04a301fd64817da8d69d97c762d394a17a80..87a2b1e8f6fe4e04eea9180cdda96a25cef763d2 100644 (file)
@@ -86,6 +86,11 @@ public:
     return ret;
   }
 
+  /// @return true if object is snapdir
+  bool is_snapdir() const {
+    return snap == CEPH_SNAPDIR;
+  }
+
   /// @return snapdir version of this hobject_t
   hobject_t get_snapdir() const {
     hobject_t ret(*this);
index ba6b7ecca71759cc04f553415df477f4fad17ad6..48040b68a882dbaaed08e3b0906c39e9c1c16282 100644 (file)
@@ -8151,6 +8151,17 @@ int ReplicatedPG::recover_backfill(
     assert(i->first > new_last_backfill);
     new_last_backfill = i->first;
   }
+
+  /* If last_backfill is snapdir, we know that head necessarily cannot exist,
+   * therefore it's safe to bump the snap up to NOSNAP.  This is necessary
+   * since we need avoid having SNAPDIR backfilled and HEAD not backfilled
+   * since a transaction on HEAD might change SNAPDIR
+   */
+  if (new_last_backfill.is_snapdir())
+    new_last_backfill = new_last_backfill.get_head();
+  if (last_backfill_started.is_snapdir())
+    last_backfill_started = last_backfill_started.get_head();
+
   assert(!pending_backfill_updates.empty() ||
         new_last_backfill == last_backfill_started);
   if (pending_backfill_updates.empty() &&