Re: [PATCH v2 for-next 1/6] RDMA/rtrs-clt: During add_path change for_new_clt according to path_num
From: Leon Romanovsky <leon@kernel.org>
Date: 2021-08-08 08:34:43
From: Leon Romanovsky <leon@kernel.org>
Date: 2021-08-08 08:34:43
On Fri, Aug 06, 2021 at 01:21:07PM +0200, Md Haris Iqbal wrote:
When all the paths are removed for a session, the addition of the first path is like a new session for the storage server. Hence, for_new_clt has to be set to 1. Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com> Signed-off-by: Jack Wang <jinpu.wang@ionos.com> --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index ece3205531b8..a7b450715eaf 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c@@ -3083,6 +3083,18 @@ int rtrs_clt_create_path_from_sysfs(struct rtrs_clt *clt, if (IS_ERR(sess)) return PTR_ERR(sess); + mutex_lock(&clt->paths_mutex); + if (clt->paths_num == 0) { + /* + * When all the paths are removed for a session, + * the addition of the first path is like a new session for + * the storage server + */ + sess->for_new_clt = 1; + }
I don't like the sysfs mix in connection establishment flow, but at least it is locked now. Thanks, Reviewed-by: Leon Romanovsky <leonro@nvidia.com>