]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: fix query for ec pgs
authorSamuel Just <sam.just@inktank.com>
Fri, 21 Feb 2014 21:25:17 +0000 (13:25 -0800)
committerSamuel Just <sam.just@inktank.com>
Sat, 22 Feb 2014 20:37:55 +0000 (12:37 -0800)
We need to parse a pg_t and translate it into an spg_t.

Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/OSD.cc

index cb132ba77ff0445f80650f5ca554263ec79ea75e..bfb13a54ffccd41a3eaefac7306e8651636cd270 100644 (file)
@@ -4211,7 +4211,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist
              prefix == "mark_unfound_lost" ||
              prefix == "list_missing")
           )) {
-    spg_t pgid;
+    pg_t pgid;
 
     if (!cmd_getval(cct, cmdmap, "pgid", pgidstr)) {
       ss << "no pgid specified";
@@ -4220,16 +4220,19 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist
       ss << "couldn't parse pgid '" << pgidstr << "'";
       r = -EINVAL;
     } else {
-      PG *pg = _lookup_lock_pg(pgid);
-      if (!pg) {
-       ss << "i don't have pgid " << pgid;
-       r = -ENOENT;
-      } else {
+      spg_t pcand;
+      if (osdmap->get_primary_shard(pgid, &pcand) &&
+         _have_pg(pcand)) {
+       PG *pg = _lookup_lock_pg(pcand);
+       assert(pg);
        // simulate pg <pgid> cmd= for pg->do-command
        if (prefix != "pg")
          cmd_putval(cct, cmdmap, "cmd", prefix);
        r = pg->do_command(cmdmap, ss, data, odata);
        pg->unlock();
+      } else {
+       ss << "i don't have pgid " << pgid;
+       r = -ENOENT;
       }
     }
   }