]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: OSDMonitor makes sure pool ID is good, preventing crashiness
authorGreg Farnum <gregf@hq.newdream.net>
Mon, 12 Apr 2010 18:09:51 +0000 (11:09 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Mon, 12 Apr 2010 18:20:07 +0000 (11:20 -0700)
src/mon/OSDMonitor.cc

index ecc98837d80e759d1a51c312d6165e9f8a9af7b3..10126515613b2ea62992774095c6f98433fa9705 100644 (file)
@@ -1366,7 +1366,13 @@ bool OSDMonitor::preprocess_pool_op ( MPoolOp *m) {
   bool snap_exists = false;
   pg_pool_t *pp = 0;
   if (pending_inc.new_pools.count(m->pool)) pp = &pending_inc.new_pools[m->pool];
-  //check if the snapname exists
+  //check if the snap and snapname exists
+  if (!osdmap.get_pg_pool(m->pool)) {
+    //uh-oh, bad pool num!
+    dout(0) << "attempt to delete non-existent pool id " << m->pool << dendl;
+    _pool_op(m, -ENODATA, pending_inc.epoch);
+    return true;
+  }
   if ((osdmap.get_pg_pool(m->pool)->snap_exists(m->name.c_str())) ||
       (pp && pp->snap_exists(m->name.c_str()))) snap_exists = true;