Convert all atomic operations in isc_rwlock to release-acquire memory ordering

The memory ordering in the rwlock was all wrong, I am copying excerpts
from the https://en.cppreference.com/w/c/atomic/memory_order#Relaxed_ordering
for the convenience of the reader:

  Relaxed ordering

  Atomic operations tagged memory_order_relaxed are not synchronization
  operations; they do not impose an order among concurrent memory
  accesses. They only guarantee atomicity and modification order
  consistency.

  Release-Acquire ordering

  If an atomic store in thread A is tagged memory_order_release and an
  atomic load in thread B from the same variable is tagged
  memory_order_acquire, all memory writes (non-atomic and relaxed atomic)
  that happened-before the atomic store from the point of view of thread
  A, become visible side-effects in thread B. That is, once the atomic
  load is completed, thread B is guaranteed to see everything thread A
  wrote to memory.

  The synchronization is established only between the threads releasing
  and acquiring the same atomic variable. Other threads can see different
  order of memory accesses than either or both of the synchronized
  threads.

Which basically means that we had no or weak synchronization between
threads using the same variables in the rwlock structure.  There should
not be a significant performance drop because the critical sections were
already protected by:

  while(1) {
    if (relaxed_atomic_operation) {
      break;
    }
    LOCK(lock);
    if (!relaxed_atomic_operation) {
      WAIT(sem, lock);
    }
    UNLOCK(lock)l
  }

I would add one more thing to "Don't do your own crypto, folks.":

  - Also don't do your own locking, folks.
76 jobs for !2985 with 1428-possible-data-race-in-rbtdb-happens-occasionally-on-ppc64le in 31 minutes and 21 seconds (queued for 5 seconds)
detached
Status Job ID Name Coverage
  Precheck
passed #661146
amd64 linux
🐞:sid:amd64

00:04:05

passed #661144
amd64 linux
autoreconf:sid:amd64

00:00:32

passed #661145
amd64 linux
misc:sid:amd64

00:00:17

 
  Build
passed #661161
amd64 linux
asan:sid:amd64

00:01:41

passed #661168
amd64 freebsd
clang:freebsd11.3:amd64

00:01:06

passed #661169
amd64 freebsd
clang:freebsd12.0:amd64

00:00:58

passed #661170
amd64 libvirt
clang:openbsd6.6:amd64

00:04:31

passed #661165
amd64 linux
clang:stretch:amd64

00:01:40

passed #661166
i386 linux
clang:stretch:i386

00:02:24

passed #661147
amd64 linux
gcc:alpine3.11:amd64

00:02:39

passed #661160
amd64 linux
gcc:bionic:amd64

00:02:00

passed #661153
amd64 linux
gcc:buster:amd64

00:01:03

passed #661148
amd64 linux
gcc:centos6:amd64

00:02:15

passed #661149
amd64 linux
gcc:centos7:amd64

00:02:22

passed #661150
amd64 linux
gcc:centos8:amd64

00:02:24

passed #661158
amd64 linux
gcc:fedora31:amd64

00:02:40

passed #661151
amd64 linux
gcc:jessie:amd64

00:01:29

passed #661154
amd64 linux
gcc:sid:amd64

00:02:46

passed #661156
i386 linux
gcc:sid:i386

00:01:47

passed #661152
amd64 linux
gcc:stretch:amd64

00:01:36

passed #661157
amd64 linux
gcc:tumbleweed:amd64

00:02:37

passed #661159
amd64 linux
gcc:xenial:amd64

00:01:35

passed #661172
amd64 windows
msvc:windows:amd64

00:02:34

passed #661164
amd64 linux
mutexatomics:sid:amd64

00:01:15

passed #661171
amd64 linux
nolibtool:sid:amd64

00:01:35

passed #661155
amd64 linux
oot:sid:amd64

00:01:05

passed #661167
amd64 linux
pkcs11:sid:amd64

00:01:48

passed #661163
amd64 linux
rwlock:sid:amd64

00:01:28

passed #661162
amd64 linux
tsan:buster:amd64

00:02:46

 
  Unit
passed #661186
amd64 linux
unit:asan:sid:amd64

00:01:08

passed #661192
amd64 freebsd
unit:clang:freebsd11.3:amd64

00:00:34

passed #661193
amd64 freebsd
unit:clang:freebsd12.0:amd64

00:00:38

passed #661190
amd64 linux
unit:clang:stretch:amd64

00:00:53

passed #661173
amd64 linux
unit:gcc:alpine3.11:amd64

00:01:03

passed #661185
amd64 linux
unit:gcc:bionic:amd64

00:00:54

passed #661179
amd64 linux
unit:gcc:buster:amd64

00:00:54

passed #661174
amd64 linux
unit:gcc:centos6:amd64

00:01:16

passed #661175
amd64 linux
unit:gcc:centos7:amd64

00:00:41

passed #661176
amd64 linux
unit:gcc:centos8:amd64

00:00:41

passed #661183
amd64 linux
unit:gcc:fedora31:amd64

00:00:54

passed #661177
amd64 linux
unit:gcc:jessie:amd64

00:00:30

passed #661180
amd64 linux
unit:gcc:sid:amd64

00:00:51

passed #661181
i386 linux
unit:gcc:sid:i386

00:00:40

passed #661178
amd64 linux
unit:gcc:stretch:amd64

00:00:40

passed #661182
amd64 linux
unit:gcc:tumbleweed:amd64

00:00:55

passed #661184
amd64 linux
unit:gcc:xenial:amd64

00:00:55

failed #661189
amd64 linux allowed to fail
unit:mutexatomics:sid:amd64

00:10:50

passed #661194
amd64 linux
unit:nolibtool:sid:amd64

00:01:11

passed #661191
amd64 linux
unit:pkcs11:sid:amd64

00:00:55

passed #661188
amd64 linux
unit:rwlock:sid:amd64

00:00:40

failed #661187
amd64 linux allowed to fail
unit:tsan:buster:amd64

00:02:35

 
  System
passed #661208
amd64 linux
system:asan:sid:amd64

00:14:19

passed #661318
freebsd amd64
system:clang:freebsd11.3:amd64

00:12:29

passed #661214
amd64 freebsd
system:clang:freebsd12.0:amd64

00:12:44

passed #661195
amd64 linux
system:gcc:alpine3.11:amd64

00:12:46

passed #661207
amd64 linux
system:gcc:bionic:amd64

00:13:05

passed #661201
amd64 linux
system:gcc:buster:amd64

00:12:01

passed #661196
amd64 linux
system:gcc:centos6:amd64

00:12:36

passed #661197
amd64 linux
system:gcc:centos7:amd64

00:11:51

passed #661198
amd64 linux
system:gcc:centos8:amd64

00:11:52

passed #661205
amd64 linux
system:gcc:fedora31:amd64

00:13:19

passed #661199
amd64 linux
system:gcc:jessie:amd64

00:12:23

passed #661202
amd64 linux
system:gcc:sid:amd64

00:12:18

passed #661203
i386 linux
system:gcc:sid:i386

00:12:49

passed #661200
amd64 linux
system:gcc:stretch:amd64

00:12:39

passed #661204
amd64 linux
system:gcc:tumbleweed:amd64

00:12:17

passed #661206
amd64 linux
system:gcc:xenial:amd64

00:11:42

passed #661211
amd64 linux
system:mutexatomics:sid:amd64

00:12:27

passed #661215
amd64 linux
system:nolibtool:sid:amd64

00:12:39

passed #661212
amd64 linux
system:pkcs11:sid:amd64

00:12:50

passed #661210
amd64 linux
system:rwlock:sid:amd64

00:12:50

failed #661209
amd64 linux allowed to fail
system:tsan:buster:amd64

00:18:04

failed #661213
amd64 freebsd
system:clang:freebsd11.3:amd64

00:12:46

 
  Docs
passed #661216
amd64 linux
docs:sid:amd64

00:01:05

 
  Postcheck
passed #661218
amd64 linux
cppcheck:gcc:sid:amd64

00:01:58

passed #661217
amd64 linux
scan-build:buster:amd64

00:11:09

 
Name Stage Failure
failed
system:tsan:buster:amd64 System
make: *** [Makefile:486: test] Error 1
Running after script...
$ find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
Uploading artifacts...
bin/tests/system/*/tsan.*: found 18 matching files
bin/tests/system/*/*/tsan.*: found 269 matching files

tsan/: found 207 matching files

Uploading artifacts to coordinator... ok
id=661209 responseStatus=201 Created token=w3ZKUAgo
ERROR: Job failed: exit code 1
failed
unit:mutexatomics:sid:amd64 Unit
Generating kyua_html/lib_ns_tests_query_test_main.html
Generating kyua_html/report.css
Generating kyua_html/index.html
Uploading artifacts...
kyua.log: found 1 matching files
kyua.results: found 1 matching files

kyua_html/: found 70 matching files

Uploading artifacts to coordinator... ok
id=661189 responseStatus=201 Created token=yMkeqsHg
ERROR: Job failed: exit code 1
failed
unit:tsan:buster:amd64 Unit
$ find lib -name 'tsan.*' -exec python3 util/parse_tsan.py {} \;
Uploading artifacts...
WARNING: lib/*/tests/tsan.*: no matching files
WARNING: tsan/: no matching files
kyua.log: found 1 matching files

kyua.results: found 1 matching files

WARNING: kyua_html/: no matching files
Uploading artifacts to coordinator... ok
id=661187 responseStatus=201 Created token=BPSgJL3y
ERROR: Job failed: exit code 1