Re: [PATCH for-next 06/22] RDMA/rtrs-clt: Break if one sess is connected in rtrs_clt_is_connected

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 1, 2021 at 8:38 PM Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:
>
> On Thu, Mar 25, 2021 at 04:32:52PM +0100, Gioh Kim wrote:
> > 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
> > +++ 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 <guoqing.jiang@xxxxxxxxxxxxxxx>
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 <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>
---
 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
From 0362520ca0f974ff787a13b3fc36ff4dbef08aad Mon Sep 17 00:00:00 2001
From: Guoqing Jiang <guoqing.jiang@xxxxxxxxxxxxxxx>
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 <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>
---
 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


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux