From 79e78bdbf32490f4402a300762fe3edaa70926fe Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 7 Apr 2017 09:50:12 -0400 Subject: [PATCH] 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 --- src/osd/PG.cc | 5 +++++ src/osd/PG.h | 1 + 2 files changed, 6 insertions(+) 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( -- 2.47.3