]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: initialize send_notify on pg load
authorSage Weil <sage@inktank.com>
Sat, 28 Jul 2012 16:19:03 +0000 (09:19 -0700)
committerSage Weil <sage@inktank.com>
Mon, 30 Jul 2012 17:49:16 +0000 (10:49 -0700)
When the PG is loaded, we need to set send_notify if we are not the
primary.  Otherwise, if the PG does not go through
start_peering_interval() or experience a role change, we will not set
the flag and tell the primary that we exist.  This can cause problems
for example if we have unfound objects that the primary needs, although
I'm sure there are other bad implications as well.

Fixes: #2866
Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/PG.cc
src/osd/PG.h

index 031cdbd3b8c2546f925bbc83e20459991dce3106..64760e094682686f38a470ccdb0d82b8d88d8bd3 100644 (file)
@@ -4287,6 +4287,16 @@ PG::RecoveryState::Initial::Initial(my_context ctx)
   context< RecoveryMachine >().log_enter(state_name);
 }
 
+boost::statechart::result PG::RecoveryState::Initial::react(const Load& l)
+{
+  PG *pg = context< RecoveryMachine >().pg;
+
+  // do we tell someone we're here?
+  pg->send_notify = (pg->role != 0);
+
+  return transit< Reset >();
+}
+
 boost::statechart::result PG::RecoveryState::Initial::react(const MNotifyRec& notify)
 {
   PG *pg = context< RecoveryMachine >().pg;
index 564588eda19fd0aa9827f4c7cf71a9be9da63300..b70ae0e3f44bb9bb46b13f791c687bbc29bb9b06 100644 (file)
@@ -1077,11 +1077,12 @@ public:
 
       typedef boost::mpl::list <
        boost::statechart::transition< Initialize, Reset >,
-       boost::statechart::transition< Load, Reset >,
+       boost::statechart::custom_reaction< Load >,
        boost::statechart::custom_reaction< NullEvt >,
        boost::statechart::transition< boost::statechart::event_base, Crashed >
        > reactions;
 
+      boost::statechart::result react(const Load&);
       boost::statechart::result react(const MNotifyRec&);
       boost::statechart::result react(const MInfoRec&);
       boost::statechart::result react(const MLogRec&);