]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: verify that the pool id is valid on SET[DIR]LAYOUT
authorSage Weil <sage@inktank.com>
Thu, 6 Dec 2012 08:11:00 +0000 (00:11 -0800)
committerSage Weil <sage@inktank.com>
Mon, 24 Dec 2012 03:39:22 +0000 (19:39 -0800)
Make sure the data pool exists and is part of the MDSMap data pools list.

Signed-off-by: Sage Weil <sage@inktank.com>
src/mds/Server.cc

index 11c56ddbc277fe094bbcaddb970ee4ff08812aab..ec4fb01f01937c5ae3071b7b38291a89be18aa06 100644 (file)
@@ -3294,6 +3294,12 @@ void Server::handle_client_setlayout(MDRequest *mdr)
     reply_request(mdr, -EINVAL);
     return;
   }
+  if (!mds->osdmap->have_pg_pool(layout.fl_pg_pool) ||
+      !mds->mdsmap->is_data_pg_pool(layout.fl_pg_pool)) {
+    dout(10) << " invalid data pool " << layout.fl_pg_pool << dendl;
+    reply_request(mdr, -EINVAL);
+    return;
+  }
 
   xlocks.insert(&cur->filelock);
   if (!mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks))
@@ -3365,6 +3371,13 @@ void Server::handle_client_setdirlayout(MDRequest *mdr)
     delete layout;
     return;
   }
+  if (!mds->osdmap->have_pg_pool(layout->layout.fl_pg_pool) ||
+      !mds->mdsmap->is_data_pg_pool(layout->layout.fl_pg_pool)) {
+    dout(10) << " invalid data pool " << layout->layout.fl_pg_pool << dendl;
+    reply_request(mdr, -EINVAL);
+    delete layout;
+    return;
+  }
 
   cur->project_inode();
   cur->get_projected_node()->dir_layout = layout;