RDMA/rtrs-srv: Report temporary sessname for error message
authorGioh Kim <gi-oh.kim@cloud.ionos.com>
Thu, 25 Mar 2021 15:33:02 +0000 (16:33 +0100)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 1 Apr 2021 18:59:46 +0000 (15:59 -0300)
Before receiving the session name, the error message cannot include any
information about which connection generates the error.

This patch stores the addresses of source and target in the sessname field
to show which generates the error. That field will be over-written
when receiving the session name from client.

Link: https://lore.kernel.org/r/20210325153308.1214057-17-gi-oh.kim@ionos.com
Signed-off-by: Gioh Kim <gi-oh.kim@ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/ulp/rtrs/rtrs-srv.c

index 9fe4ab1..739b9b1 100644 (file)
@@ -1683,6 +1683,9 @@ static struct rtrs_srv_sess *__alloc_sess(struct rtrs_srv *srv,
 {
        struct rtrs_srv_sess *sess;
        int err = -ENOMEM;
+       char str[NAME_MAX];
+       struct rtrs_sess *s;
+       struct rtrs_addr path;
 
        if (srv->paths_num >= MAX_PATHS_NUM) {
                err = -ECONNRESET;
@@ -1717,6 +1720,14 @@ static struct rtrs_srv_sess *__alloc_sess(struct rtrs_srv *srv,
        sess->cur_cq_vector = -1;
        sess->s.dst_addr = cm_id->route.addr.dst_addr;
        sess->s.src_addr = cm_id->route.addr.src_addr;
+
+       /* temporary until receiving session-name from client */
+       s = &sess->s;
+       path.src = &sess->s.src_addr;
+       path.dst = &sess->s.dst_addr;
+       rtrs_addr_to_str(&path, str, sizeof(str));
+       strlcpy(sess->s.sessname, str, sizeof(sess->s.sessname));
+
        sess->s.con_num = con_num;
        sess->s.recon_cnt = recon_cnt;
        uuid_copy(&sess->s.uuid, uuid);