← Back to team overview

percona-discussion team mailing list archive

[Merge] lp:~percona-dev/percona-patches/fix-rwlock-bug333750 into lp:percona-patches

 

Yasufumi Kinoshita has proposed merging lp:~percona-dev/percona-patches/fix-rwlock-bug333750 into lp:percona-patches.

Requested reviews:
    Percona developers (percona-dev)
-- 
https://code.launchpad.net/~percona-dev/percona-patches/fix-rwlock-bug333750/+merge/4613
Your team Percona developers is subscribed to branch lp:percona-patches.
=== modified file 'innodb_rw_lock.patch'
--- innodb_rw_lock.patch	2009-02-12 01:54:35 +0000
+++ innodb_rw_lock.patch	2009-03-18 07:09:46 +0000
@@ -252,7 +252,7 @@
 diff -r 962aec0d731c innobase/include/sync0rw.ic
 --- a/innobase/include/sync0rw.ic	Thu Oct 09 08:28:53 2008 -0700
 +++ b/innobase/include/sync0rw.ic	Thu Oct 09 08:30:28 2008 -0700
-@@ -47,20 +47,52 @@
+@@ -47,20 +47,56 @@
  Accessor functions for rw lock. */
  UNIV_INLINE
  ulint
@@ -306,7 +306,11 @@
 +	rw_lock_t*      lock,
 +	ulint           flag)
 +{
++#ifdef HAVE_GCC_ATOMIC_BUILTINS
++	__sync_lock_test_and_set(&(lock->wait_ex_waiters),flag);
++#else
 +	lock->wait_ex_waiters = flag;
++#endif
  }
  UNIV_INLINE
  ulint
@@ -625,7 +629,7 @@
          ut_ad(rw_lock_validate(lock));
  #ifdef UNIV_SYNC_PERF_STAT
  	rw_s_exit_count++;
-@@ -435,41 +613,81 @@
+@@ -435,41 +613,79 @@
  #endif
  	)
  {
@@ -659,9 +663,7 @@
 +		          But we shouldn't keep an ID of not-owner. */
 +		lock->writer_thread = -1;
 +
-+		/* atomic operation may be safer about memory order. */
-+		rw_lock_set_writer(lock, RW_LOCK_NOT_LOCKED);
-+		__sync_synchronize();
++		__sync_lock_test_and_set(&(lock->writer),RW_LOCK_NOT_LOCKED);
 +	}
 +#else
  	lock->writer_count--;