From: Samuel Just Date: Sat, 2 Nov 2013 20:54:51 +0000 (-0700) Subject: ReplicatedPG::recover_backfill: adjust last_backfill to HEAD if snapdir X-Git-Tag: v0.72~14 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=545135f3e1c75318940caa2c82ac32a53fc4f957;p=ceph.git ReplicatedPG::recover_backfill: adjust last_backfill to HEAD if snapdir 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 Reviewed-by: Greg Farnum --- diff --git a/src/common/hobject.h b/src/common/hobject.h index edaf04a301fd..87a2b1e8f6fe 100644 --- a/src/common/hobject.h +++ b/src/common/hobject.h @@ -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); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index ba6b7ecca717..48040b68a882 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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() &&