From d006c6f2c0aa97c894f631a33d667460fcb0a72d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 10 May 2011 08:22:34 -0700 Subject: [PATCH] osd: initialize oi.oloc if on-disk value is bogus If the on-disk locator is undefined (upgrade of an old cluster?) initialize the oloc fields based on the PG::Info. Reported-by: ar Fred Tested-by: ar Fred Signed-off-by: Sage Weil --- src/osd/ReplicatedPG.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 84399caba867..2f62a866c97e 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -2732,6 +2732,13 @@ ReplicatedPG::ObjectContext *ReplicatedPG::get_object_context(const sobject_t& s } else { object_info_t oi(bv); + + // if the on-disk oloc is bad/undefined, set up the pool value + if (oi.oloc.get_pool() < 0) { + oi.oloc.pool = info.pgid.pool(); + oi.oloc.preferred = info.pgid.preferred(); + } + SnapSetContext *ssc = NULL; if (can_create) ssc = get_snapset_context(soid.oid, true); -- 2.47.3