]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
RDS: make sure the ring is really full before we return with ENOMEM
authorChris Mason <chris.mason@oracle.com>
Fri, 3 Feb 2012 16:07:39 +0000 (11:07 -0500)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 23:41:24 +0000 (16:41 -0700)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Bang Nguyen <bang.nguyen@oracle.com>
net/rds/ib_cm.c
net/rds/ib_send.c

index b91b6dacaf12ad47dd26c4601800041d4e9c61e4..b39d3ce10e0c2065e6a2a8bda0cebffa6978fa36 100644 (file)
@@ -264,10 +264,8 @@ void rds_ib_tasklet_fn_send(unsigned long data)
        ib_req_notify_cq(ic->i_scq, IB_CQ_SOLICITED);
        poll_cq(ic, ic->i_scq, ic->i_send_wc, &ack_state);
 
-       if (rds_conn_up(conn)) {
-               clear_bit(RDS_LL_SEND_FULL, &conn->c_flags);
+       if (rds_conn_up(conn) && !test_bit(RDS_LL_SEND_FULL, &conn->c_flags))
                rds_send_xmit(ic->conn);
-       }
 }
 
 void rds_ib_tasklet_fn_recv(unsigned long data)
index b152c018713b55e143c931ecdb8a669fdcb0e739..e36720d736bcf21c3984362256e25a98343571bb 100644 (file)
@@ -512,10 +512,19 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm,
 
        work_alloc = rds_ib_ring_alloc(&ic->i_send_ring, i, &pos);
        if (work_alloc == 0) {
+               /* there is a window right here where someone could
+                * have freed up entries on the ring.  Lets make
+                * sure it really really really is full.
+                */
                set_bit(RDS_LL_SEND_FULL, &conn->c_flags);
-               rds_ib_stats_inc(s_ib_tx_ring_full);
-               ret = -ENOMEM;
-               goto out;
+               smp_mb();
+               work_alloc = rds_ib_ring_alloc(&ic->i_send_ring, i, &pos);
+               if (work_alloc == 0) {
+                       rds_ib_stats_inc(s_ib_tx_ring_full);
+                       ret = -ENOMEM;
+                       goto out;
+               }
+               clear_bit(RDS_LL_SEND_FULL, &conn->c_flags);
        }
 
        if (ic->i_flowctl) {