From: Sage Weil Date: Fri, 7 Apr 2017 13:50:12 +0000 (-0400) Subject: osd/PG: only correct filestore collection bits on load X-Git-Tag: v12.0.2~140^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F14397%2Fhead;p=ceph.git osd/PG: only correct filestore collection bits on load PG::update_store_with_options() is called on load *and* when the pool properties change, but if we only need to fix bits right at load time. More importantly, but doing a second check on pool change, we may race with a previously queued collection create that is not yet readable via filestore, try to (synchronously) set the property again, and deadlock. Fixes: http://tracker.ceph.com/issues/19541 Signed-off-by: Sage Weil --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index a52a339d0166..6a3d3a285ffa 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -5850,7 +5850,10 @@ void PG::update_store_with_options() if(r < 0 && r != -EOPNOTSUPP) { derr << __func__ << "set_collection_opts returns error:" << r << dendl; } +} +void PG::update_store_on_load() +{ if (osd->store->get_type() == "filestore") { // legacy filestore didn't store collection bit width; fix. int bits = osd->store->collection_bits(coll); @@ -5907,6 +5910,8 @@ boost::statechart::result PG::RecoveryState::Initial::react(const Load& l) pg->send_notify = (!pg->is_primary()); pg->update_store_with_options(); + pg->update_store_on_load(); + return transit< Reset >(); } diff --git a/src/osd/PG.h b/src/osd/PG.h index bbfb037257b6..4763859d66b9 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2242,6 +2242,7 @@ private: void prepare_write_info(map *km); void update_store_with_options(); + void update_store_on_load(); public: static int _prepare_write_info(