From b6f5f343eb95a31ecedf5cd7aa820eea3d87c65d Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Wed, 27 Dec 2017 18:05:41 +0800 Subject: [PATCH] mds: make sure mds has uptodate mdsmap before checking 'allows_snaps' Signed-off-by: "Yan, Zheng" --- src/mds/Server.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index aec77b35531af..d78b48510edf0 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -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); -- 2.39.5