]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
rds: Fix non-atomic operation on shared flag variable
authorHåkon Bugge <Haakon.Bugge@oracle.com>
Tue, 5 Sep 2017 15:42:01 +0000 (17:42 +0200)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 25 Sep 2017 22:37:50 +0000 (15:37 -0700)
The bits in m_flags in struct rds_message are used for a plurality of
reasons, and from different contexts. To avoid any missing updates to
m_flags, use the atomic set_bit() instead of the non-atomic equivalent.

Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
Reviewed-by: Knut Omang <knut.omang@oracle.com>
Reviewed-by: Wei Lin Guay <wei.lin.guay@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry-picked from upstream f530f39f5ff97209cc6f1bf66e634685954ad741)

Orabug: 26842076

Reviewed-by: Avinash Repaka <avinash.repaka@oracle.com>
net/rds/send.c

index c203654c7bddbe8a79bb6d99b556414502c7d96f..c657f43b2b293e0d78f05f05279a5f1a8fb676a2 100644 (file)
@@ -339,7 +339,7 @@ restart:
                        len = ntohl(rm->m_inc.i_hdr.h_len);
                        if (cp->cp_unacked_packets == 0 ||
                            cp->cp_unacked_bytes < len) {
-                               __set_bit(RDS_MSG_ACK_REQUIRED, &rm->m_flags);
+                               set_bit(RDS_MSG_ACK_REQUIRED, &rm->m_flags);
 
                                cp->cp_unacked_packets =
                                        rds_sysctl_max_unacked_packets;
@@ -988,7 +988,7 @@ static int rds_send_queue_rm(struct rds_sock *rs, struct rds_connection *conn,
                 * throughput hits a certain threshold.
                 */
                if (rs->rs_snd_bytes >= rds_sk_sndbuf(rs) / 2)
-                       __set_bit(RDS_MSG_ACK_REQUIRED, &rm->m_flags);
+                       set_bit(RDS_MSG_ACK_REQUIRED, &rm->m_flags);
 
                list_add_tail(&rm->m_sock_item, &rs->rs_send_queue);
                set_bit(RDS_MSG_ON_SOCK, &rm->m_flags);