]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/rdma: fix error argument to get right qp state
authorChangcheng Liu <changcheng.liu@aliyun.com>
Fri, 28 Jun 2019 06:26:41 +0000 (14:26 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Fri, 23 Aug 2019 02:45:05 +0000 (10:45 +0800)
1. It's wrong to use "-1" as argument to query queue state.
In rdma library, ibv_query_qp will call ibv_cmd_query_qp to query
queue state. If "-1" is used as attr_mask, ibv_cmd_query_qp will
return error EOPNOTSUPP which means query failed.

2. In class QueuePair, is_error() could use member function get_state()
to get the queue pair state.

3. It's better to use qp_state as queue pair state according to
ibv_query_qp manual guide.
   struct ibv_qp_attr {
      enum ibv_qp_state       qp_state;            /* Current QP state */
      enum ibv_qp_state       cur_qp_state;        /* Current QP state - irrelevant for ibv_query_qp */
      ...

Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
src/msg/async/rdma/Infiniband.cc

index 1fab149aa45f30711790e3c522d84c4b3eb65bce..0631d8c1490f948836d283216e622d14419e0e8c 100644 (file)
@@ -353,15 +353,14 @@ int Infiniband::QueuePair::get_state() const
 bool Infiniband::QueuePair::is_error() const
 {
   ibv_qp_attr qpa;
-  ibv_qp_init_attr qpia;
 
-  int r = ibv_query_qp(qp, &qpa, -1, &qpia);
+  int r = get_state();
   if (r) {
     lderr(cct) << __func__ << " failed to get state: "
       << cpp_strerror(errno) << dendl;
     return true;
   }
-  return qpa.cur_qp_state == IBV_QPS_ERR;
+  return qpa.qp_state == IBV_QPS_ERR;
 }