From: Md Haris Iqbal <haris.iqbal@ionos.com>
To: linux-rdma@vger.kernel.org
Cc: bvanassche@acm.org, leon@kernel.org, jgg@ziepe.ca,
haris.iqbal@ionos.com, jinpu.wang@ionos.com,
Grzegorz Prajsner <grzegorz.prajsner@ionos.com>
Subject: [PATCH v2 for-next 3/9] RDMA/rtrs-srv: Check return values while processing info request
Date: Mon, 20 Nov 2023 16:41:40 +0100 [thread overview]
Message-ID: <20231120154146.920486-4-haris.iqbal@ionos.com> (raw)
In-Reply-To: <20231120154146.920486-1-haris.iqbal@ionos.com>
While processing info request, it could so happen that the srv_path goes
to CLOSING state, cause of any of the error events from RDMA. That state
change should be picked up while trying to change the state in
process_info_req, by checking the return value. In case the state change
call in process_info_req fails, we fail the processing.
We should also check the return value for rtrs_srv_path_up, since it
sends a link event to the client above, and the client can fail for any
reason.
Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality")
Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Grzegorz Prajsner <grzegorz.prajsner@ionos.com>
---
drivers/infiniband/ulp/rtrs/rtrs-srv.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
index ab4200041fd3..4be0e5b132d4 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
@@ -710,20 +710,23 @@ static void rtrs_srv_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc)
WARN_ON(wc->opcode != IB_WC_SEND);
}
-static void rtrs_srv_path_up(struct rtrs_srv_path *srv_path)
+static int rtrs_srv_path_up(struct rtrs_srv_path *srv_path)
{
struct rtrs_srv_sess *srv = srv_path->srv;
struct rtrs_srv_ctx *ctx = srv->ctx;
- int up;
+ int up, ret = 0;
mutex_lock(&srv->paths_ev_mutex);
up = ++srv->paths_up;
if (up == 1)
- ctx->ops.link_ev(srv, RTRS_SRV_LINK_EV_CONNECTED, NULL);
+ ret = ctx->ops.link_ev(srv, RTRS_SRV_LINK_EV_CONNECTED, NULL);
mutex_unlock(&srv->paths_ev_mutex);
/* Mark session as established */
- srv_path->established = true;
+ if (!ret)
+ srv_path->established = true;
+
+ return ret;
}
static void rtrs_srv_path_down(struct rtrs_srv_path *srv_path)
@@ -852,7 +855,12 @@ static int process_info_req(struct rtrs_srv_con *con,
goto iu_free;
kobject_get(&srv_path->kobj);
get_device(&srv_path->srv->dev);
- rtrs_srv_change_state(srv_path, RTRS_SRV_CONNECTED);
+ err = rtrs_srv_change_state(srv_path, RTRS_SRV_CONNECTED);
+ if (!err) {
+ rtrs_err(s, "rtrs_srv_change_state(), err: %d\n", err);
+ goto iu_free;
+ }
+
rtrs_srv_start_hb(srv_path);
/*
@@ -861,7 +869,11 @@ static int process_info_req(struct rtrs_srv_con *con,
* all connections are successfully established. Thus, simply notify
* listener with a proper event if we are the first path.
*/
- rtrs_srv_path_up(srv_path);
+ err = rtrs_srv_path_up(srv_path);
+ if (err) {
+ rtrs_err(s, "rtrs_srv_path_up(), err: %d\n", err);
+ goto iu_free;
+ }
ib_dma_sync_single_for_device(srv_path->s.dev->ib_dev,
tx_iu->dma_addr,
--
2.25.1
next prev parent reply other threads:[~2023-11-20 15:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 15:41 [PATCH v2 for-next 0/9] Misc patches for RTRS Md Haris Iqbal
2023-11-20 15:41 ` [PATCH v2 for-next 1/9] RDMA/rtrs-srv: Do not unconditionally enable irq Md Haris Iqbal
2023-11-20 15:41 ` [PATCH v2 for-next 2/9] RDMA/rtrs-clt: Start hb after path_up Md Haris Iqbal
2023-11-20 15:41 ` Md Haris Iqbal [this message]
2023-11-20 15:41 ` [PATCH v2 for-next 4/9] RDMA/rtrs-srv: Free srv_mr iu only when always_invalidate is true Md Haris Iqbal
2023-11-20 15:41 ` [PATCH v2 for-next 5/9] RDMA/rtrs-srv: Destroy path files after making sure no IOs in-flight Md Haris Iqbal
2023-11-20 15:41 ` [PATCH v2 for-next 6/9] RDMA/rtrs-clt: Fix the max_send_wr setting Md Haris Iqbal
2023-11-20 15:41 ` [PATCH v2 for-next 7/9] RDMA/rtrs-clt: Remove the warnings for req in_use check Md Haris Iqbal
2023-11-20 15:41 ` [PATCH v2 for-next 8/9] RDMA/rtrs-clt: use %pe to print errors Md Haris Iqbal
2023-11-20 15:41 ` [PATCH v2 for-next 9/9] RDMA/rtrs: " Md Haris Iqbal
2023-11-22 11:44 ` [PATCH v2 for-next 0/9] Misc patches for RTRS Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231120154146.920486-4-haris.iqbal@ionos.com \
--to=haris.iqbal@ionos.com \
--cc=bvanassche@acm.org \
--cc=grzegorz.prajsner@ionos.com \
--cc=jgg@ziepe.ca \
--cc=jinpu.wang@ionos.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox