Unverified Commit 108a0666 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!9076 RDMA/cma: Ensure rdma_addr_cancel() happens before issuing more requests

parents 196331cd 085511d2
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -1643,6 +1643,14 @@ static void cma_cancel_operation(struct rdma_id_private *id_priv,
{
	switch (state) {
	case RDMA_CM_ADDR_QUERY:
		/*
		 * We can avoid doing the rdma_addr_cancel() based on state,
		 * only RDMA_CM_ADDR_QUERY has a work that could still execute.
		 * Notice that the addr_handler work could still be exiting
		 * outside this state, however due to the interaction with the
		 * handler_mutex the work is guaranteed not to touch id_priv
		 * during exit.
		 */
		rdma_addr_cancel(&id_priv->id.route.addr.dev_addr);
		break;
	case RDMA_CM_ROUTE_QUERY:
@@ -3460,6 +3468,21 @@ int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
		if (dst_addr->sa_family == AF_IB) {
			ret = cma_resolve_ib_addr(id_priv);
		} else {
			/*
			 * The FSM can return back to RDMA_CM_ADDR_BOUND after
			 * rdma_resolve_ip() is called, eg through the error
			 * path in addr_handler(). If this happens the existing
			 * request must be canceled before issuing a new one.
			 * Since canceling a request is a bit slow and this
			 * oddball path is rare, keep track once a request has
			 * been issued. The track turns out to be a permanent
			 * state since this is the only cancel as it is
			 * immediately before rdma_resolve_ip().
			 */
			if (id_priv->used_resolve_ip)
				rdma_addr_cancel(&id->route.addr.dev_addr);
			else
				id_priv->used_resolve_ip = 1;
			ret = rdma_resolve_ip(cma_src_addr(id_priv),
					      dst_addr, &id->route.addr.dev_addr,
					      timeout_ms, addr_handler, id_priv);
+1 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ struct rdma_id_private {
	bool			tos_set;
	u8			reuseaddr;
	u8			afonly;
	u8			used_resolve_ip;
	enum ib_gid_type	gid_type;

	/*