]> www.infradead.org Git - users/jedix/linux-maple.git/commit
rds: Make sure updates to cp_send_gen can be observed
authorHåkon Bugge <Haakon.Bugge@oracle.com>
Thu, 20 Jul 2017 10:28:55 +0000 (12:28 +0200)
committerChuck Anderson <chuck.anderson@oracle.com>
Wed, 2 Aug 2017 03:47:40 +0000 (20:47 -0700)
commitdeee422994105b214448d01c7fd265f5789e7f15
tree7865031f7f3879edb24718cb9f4bf2faa4b1cd25
parentb5f578e4dea74970bbacc34e157d85ec21ba640f
rds: Make sure updates to cp_send_gen can be observed

cp->cp_send_gen is treated as a normal variable, although it may be
used by different threads.

This is fixed by using {READ,WRITE}_ONCE when it is incremented and
READ_ONCE when it is read outside the {acquire,release}_in_xmit
protection.

Normative reference from the Linux-Kernel Memory Model:

    Loads from and stores to shared (but non-atomic) variables should
    be protected with the READ_ONCE(), WRITE_ONCE(), and
    ACCESS_ONCE().

Clause 5.1.2.4/25 in the C standard is also relevant.

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

Orabug: 26519030

Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
net/rds/send.c