netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] rds: Fix non-atomic operation on shared flag variable
@ 2017-09-05 15:42 Håkon Bugge
  2017-09-05 16:33 ` Santosh Shilimkar
       [not found] ` <20170905154201.30198-1-Haakon.Bugge-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Håkon Bugge @ 2017-09-05 15:42 UTC (permalink / raw)
  To: Santosh Shilimkar, David S . Miller
  Cc: netdev, linux-rdma, rds-devel, linux-kernel, knut.omang,
	wei.lin.guay

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>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] rds: Fix non-atomic operation on shared flag variable
  2017-09-05 15:42 [PATCH net] rds: Fix non-atomic operation on shared flag variable Håkon Bugge
@ 2017-09-05 16:33 ` Santosh Shilimkar
       [not found] ` <20170905154201.30198-1-Haakon.Bugge-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Santosh Shilimkar @ 2017-09-05 16:33 UTC (permalink / raw)
  To: Håkon Bugge
  Cc: David S . Miller, netdev, linux-rdma, rds-devel, linux-kernel,
	knut.omang, wei.lin.guay

On 9/5/2017 8:42 AM, Håkon Bugge wrote:
> 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>
> ---
>   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 <santosh.shilimkar@oracle.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] rds: Fix non-atomic operation on shared flag variable
       [not found] ` <20170905154201.30198-1-Haakon.Bugge-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
@ 2017-09-05 21:50   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2017-09-05 21:50 UTC (permalink / raw)
  To: Haakon.Bugge-QHcLZuEGTsvQT0dZR+AlfA
  Cc: santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA,
	netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	rds-devel-N0ozoZBvEnrZJqsBc5GL+g,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	knut.omang-QHcLZuEGTsvQT0dZR+AlfA,
	wei.lin.guay-QHcLZuEGTsvQT0dZR+AlfA

From: Håkon Bugge <Haakon.Bugge-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
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 <haakon.bugge-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Reviewed-by: Knut Omang <knut.omang-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> Reviewed-by: Wei Lin Guay <wei.lin.guay-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-05 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-05 15:42 [PATCH net] rds: Fix non-atomic operation on shared flag variable Håkon Bugge
2017-09-05 16:33 ` Santosh Shilimkar
     [not found] ` <20170905154201.30198-1-Haakon.Bugge-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-09-05 21:50   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).