On Thu, Apr 1, 2021 at 8:38 PM Jason Gunthorpe wrote: > > On Thu, Mar 25, 2021 at 04:32:52PM +0100, Gioh Kim wrote: > > From: Guoqing Jiang > > > > No need to continue the loop if one sess is connected. > > > > Signed-off-by: Guoqing Jiang > > Reviewed-by: Danil Kipnis > > Signed-off-by: Gioh Kim > > Signed-off-by: Jack Wang > > .../fault-injection/rtrs-fault-injection.rst | 12 ++++++------ > > drivers/infiniband/ulp/rtrs/rtrs-clt.c | 5 ++++- > > 2 files changed, 10 insertions(+), 7 deletions(-) > > > > diff --git a/Documentation/fault-injection/rtrs-fault-injection.rst b/Documentation/fault-injection/rtrs-fault-injection.rst > > index 775a223fef09..65ffe26ece67 100644 > > +++ b/Documentation/fault-injection/rtrs-fault-injection.rst > > @@ -17,10 +17,10 @@ Example 1: Inject an error into request processing of rtrs-client > > > > Generate an error on one session of rtrs-client:: > > - > > - echo 100 > /sys/kernel/debug/ip\:192.168.123.144@ip\:192.168.123.190/fault_inject/probability > > - echo 1 > /sys/kernel/debug/ip\:192.168.123.144@ip\:192.168.123.190/fault_inject/times > > - echo 1 > /sys/kernel/debug/ip\:192.168.123.144@ip\:192.168.123.190/fault_inject/fail-request > > + > > + echo 100 > /sys/kernel/debug/ip\:192.168.123.144@ip\:192.168.123.190/fault_inject/probability > > + echo 1 > /sys/kernel/debug/ip\:192.168.123.144@ip\:192.168.123.190/fault_inject/times > > + echo 1 > /sys/kernel/debug/ip\:192.168.123.144@ip\:192.168.123.190/fault_inject/fail-request > > dd if=/dev/rnbd0 of=./dd bs=1k count=10 > > > > Expected Result:: > > @@ -72,12 +72,12 @@ Example 2: rtrs-server does not send ACK to the heart-beat of rtrs-client > > echo 100 > /sys/kernel/debug/ip\:192.168.123.190@ip\:192.168.123.144/fault_inject/probability > > echo 5 > /sys/kernel/debug/ip\:192.168.123.190@ip\:192.168.123.144/fault_inject/times > > echo 1 > /sys/kernel/debug/ip\:192.168.123.190@ip\:192.168.123.144/fault_inject/fail-hb-ack > > - > > + > > Expected Result:: > > > > If rtrs-server does not send ACK more than 5 times, rtrs-client tries reconnection. > > > > Check how many times rtrs-client did reconnection:: > > > > - cat /sys/devices/virtual/rtrs-client/bla/paths/ip\:192.168.122.142@ip\:192.168.122.130/stats/reconnects > > + cat /sys/devices/virtual/rtrs-client/bla/paths/ip\:192.168.122.142@ip\:192.168.122.130/stats/reconnects > > 1 0 > > Why is all of this in this patch? I am terribly sorry. That is a rebase error. > > > diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c > > index 4f7690137e42..bfb5be5481e7 100644 > > +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c > > @@ -51,7 +51,10 @@ static inline bool rtrs_clt_is_connected(const struct rtrs_clt *clt) > > > > rcu_read_lock(); > > list_for_each_entry_rcu(sess, &clt->paths_list, s.entry) > > - connected |= READ_ONCE(sess->state) == RTRS_CLT_CONNECTED; > > + if (READ_ONCE(sess->state) == RTRS_CLT_CONNECTED) { > > + connected = true; > > + break; > > + } > > rcu_read_unlock(); > > I assume this is the intended change? rebase error? It is a rebase error. Just in case, I copied the corrected patch below and also attached it. If you want me to send the patch again, please inform me. ------------------------------------------------- 8< ---------------------------------------------------------- From 0362520ca0f974ff787a13b3fc36ff4dbef08aad Mon Sep 17 00:00:00 2001 From: Guoqing Jiang Date: Sun, 6 Dec 2020 04:20:58 +0100 Subject: [PATCH] RDMA/rtrs-clt: Break if one sess is connected in rtrs_clt_is_connected No need to continue the loop if one sess is connected. Signed-off-by: Guoqing Jiang Reviewed-by: Danil Kipnis Signed-off-by: Gioh Kim Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 5062328ac577..1b75d2e4860e 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -51,7 +51,10 @@ static inline bool rtrs_clt_is_connected(const struct rtrs_clt *clt) rcu_read_lock(); list_for_each_entry_rcu(sess, &clt->paths_list, s.entry) - connected |= READ_ONCE(sess->state) == RTRS_CLT_CONNECTED; + if (READ_ONCE(sess->state) == RTRS_CLT_CONNECTED) { + connected = true; + break; + } rcu_read_unlock(); return connected; -- 2.25.1