From: Xiubo Li Date: Tue, 12 Jul 2022 14:42:23 +0000 (+0800) Subject: client: fail the request if the peer MDS doesn't support getvxattr op X-Git-Tag: v17.2.6~465^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=debb6031a83f441a12bd2662e592710040a5f954;p=ceph.git client: fail the request if the peer MDS doesn't support getvxattr op Just fail the request instead sending the request out, or the peer MDS will crash. Fixes: https://tracker.ceph.com/issues/56529 Signed-off-by: Xiubo Li (cherry picked from commit 953d637db4b4799b0254c55ab52d2f515d175ff3) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 2f611ec1541d..68ba4ee30c31 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1791,7 +1791,8 @@ int Client::make_request(MetaRequest *request, const UserPerm& perms, InodeRef *ptarget, bool *pcreated, mds_rank_t use_mds, - bufferlist *pdirbl) + bufferlist *pdirbl, + size_t feature_needed) { int r = 0; @@ -1875,6 +1876,11 @@ int Client::make_request(MetaRequest *request, session = mds_sessions.at(mds); } + if (feature_needed != ULONG_MAX && !session->mds_features.test(feature_needed)) { + request->abort(-CEPHFS_EOPNOTSUPP); + break; + } + // send request. send_request(request, session.get()); @@ -1891,7 +1897,7 @@ int Client::make_request(MetaRequest *request, request->caller_cond = nullptr; // did we get a reply? - if (request->reply) + if (request->reply) break; } @@ -7521,10 +7527,14 @@ int Client::_getvxattr( req->set_string2(xattr_name); bufferlist bl; - int res = make_request(req, perms, nullptr, nullptr, rank, &bl); + int res = make_request(req, perms, nullptr, nullptr, rank, &bl, + CEPHFS_FEATURE_OP_GETVXATTR); ldout(cct, 10) << __func__ << " result=" << res << dendl; if (res < 0) { + if (res == -CEPHFS_EOPNOTSUPP) { + return -CEPHFS_ENODATA; + } return res; } diff --git a/src/client/Client.h b/src/client/Client.h index 48bbadcb893c..c48dd5ebaf20 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -924,8 +924,9 @@ protected: void dump_mds_sessions(Formatter *f, bool cap_dump=false); int make_request(MetaRequest *req, const UserPerm& perms, - InodeRef *ptarget = 0, bool *pcreated = 0, - mds_rank_t use_mds=-1, bufferlist *pdirbl=0); + InodeRef *ptarget = 0, bool *pcreated = 0, + mds_rank_t use_mds=-1, bufferlist *pdirbl=0, + size_t feature_needed=ULONG_MAX); void put_request(MetaRequest *request); void unregister_request(MetaRequest *request);