Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752120AbdIEQce (ORCPT ); Tue, 5 Sep 2017 12:32:34 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:40346 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751863AbdIEQcb (ORCPT ); Tue, 5 Sep 2017 12:32:31 -0400 Subject: Re: [PATCH net] rds: Fix non-atomic operation on shared flag variable To: =?UTF-8?Q?H=c3=a5kon_Bugge?= Cc: "David S . Miller" , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org, knut.omang@oracle.com, wei.lin.guay@oracle.com References: <20170905154201.30198-1-Haakon.Bugge@oracle.com> From: Santosh Shilimkar Organization: Oracle Corporation Message-ID: <6a4e095f-20f1-53af-a2eb-047866c1695d@oracle.com> Date: Tue, 5 Sep 2017 09:33:04 -0700 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170905154201.30198-1-Haakon.Bugge@oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1588 Lines: 39 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 > Reviewed-by: Knut Omang > Reviewed-by: Wei Lin Guay > --- > 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