Set SPIN_INITIALIZER value to 0 for s390x


I am trying to build Couchbase server on s390x architecture (RHEL7/SLES12). After successful build, when I ran the test cases, following test cases failed for s390x:

  1.   bcache_test
  2.   atomic_test
  3.   filemgr_test
  4.   btreeblock_test
  5.   docio_test
  6.   hbtrie_test
  7.   crc_test
  8.   btree_str_kv_test
  9.   btree_kv_test
  10. fdb_functional_test
  11. fdb_extended_test
  12. compact_functional_test
  13. iterator_functional_test
  14. mvcc_functional_test
  15. multi_kv_functional_test
  16. fdb_anomaly_test

I made following change in the code to make 16 test cases pass:

bash-4.2# diff ./forestdb/src/arch.h_ORIG ./forestdb/src/arch.h
#if defined(s390x)
#define SPIN_INITIALIZER (spin_t)(0)

The above code change is required because older code was setting SPIN_INITIALIZER value to 1. This was causing ‘spin_lock’ to wait infinitely for spin lock which is not acquired by any
other thread (it’s just the lock is initialized with wrong value). Adding a check – “#if defined _s390x)” will make sure that the functionality doesn’t get changed for other architectures.