]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: make sure mds has uptodate mdsmap before checking 'allows_snaps'
authorYan, Zheng <zyan@redhat.com>
Wed, 27 Dec 2017 10:05:41 +0000 (18:05 +0800)
committerYan, Zheng <zyan@redhat.com>
Fri, 9 Feb 2018 10:42:29 +0000 (18:42 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/Server.cc

index aec77b35531afbfabc5ca57011e964bf56e0bf2d..d78b48510edf0db0e12f1d934a7f9a5d3301a7c2 100644 (file)
@@ -8981,13 +8981,18 @@ struct C_MDS_mksnap_finish : public ServerLogContext {
 /* This function takes responsibility for the passed mdr*/
 void Server::handle_client_mksnap(MDRequestRef& mdr)
 {
+  MClientRequest *req = mdr->client_request;
+  // make sure we have as new a map as the client
+  if (req->get_mdsmap_epoch() > mds->mdsmap->get_epoch()) {
+    mds->wait_for_mdsmap(req->get_mdsmap_epoch(), new C_MDS_RetryRequest(mdcache, mdr));
+    return;
+  }
   if (!mds->mdsmap->allows_snaps()) {
     // you can't make snapshots until you set an option right now
     respond_to_request(mdr, -EPERM);
     return;
   }
 
-  MClientRequest *req = mdr->client_request;
   CInode *diri = mdcache->get_inode(req->get_filepath().get_ino());
   if (!diri || diri->state_test(CInode::STATE_PURGING)) {
     respond_to_request(mdr, -ESTALE);