rds: avoid unenecessary cong_update in loop transport
authorSantosh Shilimkar <santosh.shilimkar@oracle.com>
Thu, 14 Jun 2018 18:52:34 +0000 (11:52 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Jun 2018 02:01:49 +0000 (19:01 -0700)
Loop transport which is self loopback, remote port congestion
update isn't relevant. Infact the xmit path already ignores it.
Receive path needs to do the same.

Reported-by: syzbot+4c20b3866171ce8441d2@syzkaller.appspotmail.com
Reviewed-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/loop.c
net/rds/rds.h
net/rds/recv.c

index f2bf78de5688a3ee44862fe158bffee4ca94d91a..dac6218a460ed4d4a5b7b03ad4f6056a68784a16 100644 (file)
@@ -193,4 +193,5 @@ struct rds_transport rds_loop_transport = {
        .inc_copy_to_user       = rds_message_inc_copy_to_user,
        .inc_free               = rds_loop_inc_free,
        .t_name                 = "loopback",
+       .t_type                 = RDS_TRANS_LOOP,
 };
index b04c333d9d1c201ba4aa4617c750941cf4cdfec7..f2272fb8cd456e7b5bb2495d5d02691803c3769f 100644 (file)
@@ -479,6 +479,11 @@ struct rds_notifier {
        int                     n_status;
 };
 
+/* Available as part of RDS core, so doesn't need to participate
+ * in get_preferred transport etc
+ */
+#define        RDS_TRANS_LOOP  3
+
 /**
  * struct rds_transport -  transport specific behavioural hooks
  *
index dc67458b52f0043c2328d4a77a43536e7c62b0ed..192ac6f78ded7b0288ac01d641cd5f7772b03fd8 100644 (file)
@@ -103,6 +103,11 @@ static void rds_recv_rcvbuf_delta(struct rds_sock *rs, struct sock *sk,
                rds_stats_add(s_recv_bytes_added_to_socket, delta);
        else
                rds_stats_add(s_recv_bytes_removed_from_socket, -delta);
+
+       /* loop transport doesn't send/recv congestion updates */
+       if (rs->rs_transport->t_type == RDS_TRANS_LOOP)
+               return;
+
        now_congested = rs->rs_rcv_bytes > rds_sk_rcvbuf(rs);
 
        rdsdebug("rs %p (%pI4:%u) recv bytes %d buf %d "