]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: set CREATING flag for force-create-pg
authorSage Weil <sage@redhat.com>
Sat, 7 Apr 2018 19:35:36 +0000 (14:35 -0500)
committerSage Weil <sage@redhat.com>
Fri, 7 Sep 2018 17:08:40 +0000 (12:08 -0500)
In order to recreate a lost PG, we need to set the CREATING flag for the
pool.  This prevents pg_num from changing in future OSDMap epochs until
*after* the PG has successfully been instantiated.

Note that a pg_num change in *this* epoch is fine; the recreated PG will
instantiate in *this* epoch, which is /after/ the split a pg_num in this
epoch would describe.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc

index d30b5078987a383e24385de8e1b7bf5c18750a55..aa1c5a4d01519fedd228e66c59fa7e4b8ffdad04 100644 (file)
@@ -12005,6 +12005,13 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
     }
     if (creating_now) {
       ss << "pg " << pgidstr << " now creating, ok";
+      // set the pool's CREATING flag so that (1) the osd won't ignore our
+      // create message and (2) we won't propose any future pg_num changes
+      // until after the PG has been instantiated.
+      if (pending_inc.new_pools.count(pgid.pool()) == 0) {
+       pending_inc.new_pools[pgid.pool()] = *osdmap.get_pg_pool(pgid.pool());
+      }
+      pending_inc.new_pools[pgid.pool()].flags |= pg_pool_t::FLAG_CREATING;
       err = 0;
       goto update;
     } else {