[PATCH net] rds: Fix non-atomic operation on shared flag variable

Subsystems: networking [general], rds - reliable datagram sockets, the rest

STALE3285d REVIEWED: 2 (0M)

2 review trailers.

3 messages, 3 authors, 2017-09-05 · open the first message on its own page

[PATCH net] rds: Fix non-atomic operation on shared flag variable

From: Håkon Bugge <hidden>
Date: 2017-09-05 15:42:38

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 <redacted>
Reviewed-by: Knut Omang <redacted>
Reviewed-by: Wei Lin Guay <redacted>
---
 net/rds/send.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/rds/send.c b/net/rds/send.c
index 41b9f0f..058a407 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -273,7 +273,7 @@ int rds_send_xmit(struct rds_conn_path *cp)
 			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;
@@ -829,7 +829,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);
-- 
2.9.3

Re: [PATCH net] rds: Fix non-atomic operation on shared flag variable

From: Santosh Shilimkar <hidden>
Date: 2017-09-05 16:32:34

On 9/5/2017 8:42 AM, Håkon Bugge wrote:
quoted hunk
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 <redacted>
Reviewed-by: Knut Omang <redacted>
Reviewed-by: Wei Lin Guay <redacted>
---
  net/rds/send.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/rds/send.c b/net/rds/send.c
index 41b9f0f..058a407 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -273,7 +273,7 @@ int rds_send_xmit(struct rds_conn_path *cp)
  			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;
@@ -829,7 +829,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);
Indeed, these couple of instances remained for the m_flags.
Patch looks good. Thanks !!

Acked-by: Santosh Shilimkar <redacted>

Re: [PATCH net] rds: Fix non-atomic operation on shared flag variable

From: David Miller <davem@davemloft.net>
Date: 2017-09-05 21:50:04

From: Håkon Bugge <redacted>
Date: Tue,  5 Sep 2017 17:42:01 +0200
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 <redacted>
Reviewed-by: Knut Omang <redacted>
Reviewed-by: Wei Lin Guay <redacted>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help