From: Sage Weil Date: Sat, 28 Jul 2012 16:19:03 +0000 (-0700) Subject: osd: initialize send_notify on pg load X-Git-Tag: v0.51~57^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9e5d4e61a73343397e67e918e87f1e6dcb8ec72d;p=ceph.git osd: initialize send_notify on pg load 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 --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 031cdbd3b8c2..64760e094682 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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; diff --git a/src/osd/PG.h b/src/osd/PG.h index 564588eda19f..b70ae0e3f44b 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -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&);