From: Jeff Layton Date: Mon, 14 Oct 2019 16:13:56 +0000 (-0400) Subject: mds: send delegated_inos in openc response X-Git-Tag: v15.1.0~128^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2bcf4b62643b5dd0b50ea77dbdfb46e3a93dce67;p=ceph.git mds: send delegated_inos in openc response If the client supports octopus cephfs features, then hand it a set of inode numbers in the first create reply. The client code is similarly changed to expect a trailing set of inode numbers in that case, though the userland client doesn't do anything with them yet. Signed-off-by: Jeff Layton --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 06d71d3537a6..3ee6dc0c4428 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1544,7 +1544,7 @@ void Client::dump_mds_requests(Formatter *f) } } -int Client::verify_reply_trace(int r, +int Client::verify_reply_trace(int r, MetaSession *session, MetaRequest *request, const MConstRef& reply, InodeRef *ptarget, bool *pcreated, const UserPerm& perms) @@ -1557,12 +1557,24 @@ int Client::verify_reply_trace(int r, extra_bl = reply->get_extra_bl(); if (extra_bl.length() >= 8) { - // if the extra bufferlist has a buffer, we assume its the created inode - // and that this request to create succeeded in actually creating - // the inode (won the race with other create requests) - decode(created_ino, extra_bl); - got_created_ino = true; + if (session->mds_features.test(CEPHFS_FEATURE_DELEG_INO)) { + struct openc_response_t ocres; + + decode(ocres, extra_bl); + created_ino = ocres.created_ino; + /* + * The userland cephfs client doesn't have a way to do an async create + * (yet), so just discard delegated_inos for now. Eventually we should + * store them and use them in create calls, even if they are synchronous, + * if only for testing purposes. + */ + ldout(cct, 10) << "delegated_inos: " << ocres.delegated_inos << dendl; + } else { + // u64 containing number of created ino + decode(created_ino, extra_bl); + } ldout(cct, 10) << "make_request created ino " << created_ino << dendl; + got_created_ino = true; } if (pcreated) @@ -1670,6 +1682,7 @@ int Client::make_request(MetaRequest *request, if (use_mds >= 0) request->resend_mds = use_mds; + MetaSession *session = NULL; while (1) { if (request->aborted()) break; @@ -1704,7 +1717,6 @@ int Client::make_request(MetaRequest *request, } // open a session? - MetaSession *session = NULL; if (!have_open_session(mds)) { session = _get_or_open_mds_session(mds); @@ -1769,7 +1781,7 @@ int Client::make_request(MetaRequest *request, request->dispatch_cond = 0; if (r >= 0 && ptarget) - r = verify_reply_trace(r, request, reply, ptarget, pcreated, perms); + r = verify_reply_trace(r, session, request, reply, ptarget, pcreated, perms); if (pdirbl) *pdirbl = reply->get_extra_bl(); diff --git a/src/client/Client.h b/src/client/Client.h index a88abb5d86e8..50e91940a5da 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -802,7 +802,8 @@ protected: void put_request(MetaRequest *request); void unregister_request(MetaRequest *request); - int verify_reply_trace(int r, MetaRequest *request, const MConstRef& reply, + int verify_reply_trace(int r, MetaSession *session, MetaRequest *request, + const MConstRef& reply, InodeRef *ptarget, bool *pcreated, const UserPerm& perms); void encode_cap_releases(MetaRequest *request, mds_rank_t mds); diff --git a/src/common/options.cc b/src/common/options.cc index fbd171c743b7..6d948b7d1d23 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -7719,6 +7719,11 @@ std::vector