From: Guoqing Jiang <guoqing.jiang@xxxxxxxxxxxxxxx> No need to continue the loop if one sess is connected. Signed-off-by: Guoqing Jiang <guoqing.jiang@xxxxxxxxx> Reviewed-by: Danil Kipnis <danil.kipnis@xxxxxxxxx> Signed-off-by: Gioh Kim <gi-oh.kim@xxxxxxxxx> Signed-off-by: Jack Wang <jinpu.wang@xxxxxxxxx> --- .../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 --- a/Documentation/fault-injection/rtrs-fault-injection.rst +++ 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 diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 4f7690137e42..bfb5be5481e7 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