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: v18.0.0~203^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=953d637db4b4799b0254c55ab52d2f515d175ff3;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 --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 539b7b2d5a1..fd62c8f8216 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1889,7 +1889,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; @@ -1973,6 +1974,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()); @@ -1989,7 +1995,7 @@ int Client::make_request(MetaRequest *request, request->caller_cond = nullptr; // did we get a reply? - if (request->reply) + if (request->reply) break; } @@ -7652,10 +7658,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 e0e055b6dd1..044f533ff45 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -934,8 +934,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);