]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: initialize oi.oloc if on-disk value is bogus
authorSage Weil <sage.weil@dreamhost.com>
Tue, 10 May 2011 15:22:34 +0000 (08:22 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Tue, 10 May 2011 15:22:34 +0000 (08:22 -0700)
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 <ar.fred@yahoo.com>
Tested-by: ar Fred <ar.fred@yahoo.com>
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/osd/ReplicatedPG.cc

index 84399caba8677838e8ea635ba2e65a1e38976919..2f62a866c97e1662345d3595742b663eb90d64bb 100644 (file)
@@ -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);