List:Commits« Previous MessageNext Message »
From:marko.makela Date:June 1 2010 2:03pm
Subject:bzr commit into mysql-trunk-innodb branch (marko.makela:3133)
View as plain text  
#At file:///home/marko/innobase/dev/mysql2a/5.5-innodb/ based on revid:alik@strippedn

 3133 Marko Mäkelä	2010-06-01
      Merge a change from mysql-5.1-innodb:
      
        ------------------------------------------------------------
        revno: 3491
        revision-id: marko.makela@stripped134335-ccthwwru23kn09qw
        parent: marko.makela@oracle.com-20100601120751-1uq7bbta5n7ts0qr
        committer: Marko Mäkelä <marko.makela@stripped>
        branch nick: 5.1-innodb
        timestamp: Tue 2010-06-01 16:43:35 +0300
        message:
          Bug#48197: Concurrent rw_lock_free may cause assertion failure
      
          rw_lock_t: Remove magic_n unless UNIV_DEBUG is defined.
          rw_lock_free(): Invalidate magic_n only after removing from rw_lock_list.

    modified:
      storage/innobase/include/sync0rw.h
      storage/innobase/sync/sync0rw.c
=== modified file 'storage/innobase/include/sync0rw.h'
--- a/storage/innobase/include/sync0rw.h	revid:alik@sun.com-20100601123801-y9qv7igo16nw0umn
+++ b/storage/innobase/include/sync0rw.h	revid:marko.makela@stripped100601140355-u3kxl0yl0ljl5tx9
@@ -622,11 +622,12 @@ struct rw_lock_struct {
 	unsigned	cline:14;	/*!< Line where created */
 	unsigned	last_s_line:14;	/*!< Line number where last time s-locked */
 	unsigned	last_x_line:14;	/*!< Line number where last time x-locked */
+#ifdef UNIV_DEBUG
 	ulint	magic_n;	/*!< RW_LOCK_MAGIC_N */
-};
-
 /** Value of rw_lock_struct::magic_n */
 #define	RW_LOCK_MAGIC_N	22643
+#endif /* UNIV_DEBUG */
+};
 
 #ifdef UNIV_SYNC_DEBUG
 /** The structure for storing debug info of an rw-lock */

=== modified file 'storage/innobase/sync/sync0rw.c'
--- a/storage/innobase/sync/sync0rw.c	revid:alik@strippedom-20100601123801-y9qv7igo16nw0umn
+++ b/storage/innobase/sync/sync0rw.c	revid:marko.makela@stripped355-u3kxl0yl0ljl5tx9
@@ -278,7 +278,7 @@ rw_lock_create_func(
 	lock->level = level;
 #endif /* UNIV_SYNC_DEBUG */
 
-	lock->magic_n = RW_LOCK_MAGIC_N;
+	ut_d(lock->magic_n = RW_LOCK_MAGIC_N);
 
 	lock->cfile_name = cfile_name;
 	lock->cline = (unsigned int) cline;
@@ -293,10 +293,8 @@ rw_lock_create_func(
 
 	mutex_enter(&rw_lock_list_mutex);
 
-	if (UT_LIST_GET_LEN(rw_lock_list) > 0) {
-		ut_a(UT_LIST_GET_FIRST(rw_lock_list)->magic_n
-		     == RW_LOCK_MAGIC_N);
-	}
+	ut_ad(UT_LIST_GET_FIRST(rw_lock_list) == NULL
+	      || UT_LIST_GET_FIRST(rw_lock_list)->magic_n == RW_LOCK_MAGIC_N);
 
 	UT_LIST_ADD_FIRST(list, rw_lock_list, lock);
 
@@ -316,8 +314,6 @@ rw_lock_free_func(
 	ut_ad(rw_lock_validate(lock));
 	ut_a(lock->lock_word == X_LOCK_DECR);
 
-	lock->magic_n = 0;
-
 #ifndef INNODB_RW_LOCKS_USE_ATOMICS
 	mutex_free(rw_lock_get_mutex(lock));
 #endif /* INNODB_RW_LOCKS_USE_ATOMICS */
@@ -327,16 +323,16 @@ rw_lock_free_func(
 
 	os_event_free(lock->wait_ex_event);
 
-	if (UT_LIST_GET_PREV(list, lock)) {
-		ut_a(UT_LIST_GET_PREV(list, lock)->magic_n == RW_LOCK_MAGIC_N);
-	}
-	if (UT_LIST_GET_NEXT(list, lock)) {
-		ut_a(UT_LIST_GET_NEXT(list, lock)->magic_n == RW_LOCK_MAGIC_N);
-	}
+	ut_ad(UT_LIST_GET_PREV(list, lock) == NULL
+	      || UT_LIST_GET_PREV(list, lock)->magic_n == RW_LOCK_MAGIC_N);
+	ut_ad(UT_LIST_GET_NEXT(list, lock) == NULL
+	      || UT_LIST_GET_NEXT(list, lock)->magic_n == RW_LOCK_MAGIC_N);
 
 	UT_LIST_REMOVE(list, rw_lock_list, lock);
 
 	mutex_exit(&rw_lock_list_mutex);
+
+	ut_d(lock->magic_n = 0);
 }
 
 #ifdef UNIV_DEBUG
@@ -358,7 +354,7 @@ rw_lock_validate(
 	waiters = rw_lock_get_waiters(lock);
 	lock_word = lock->lock_word;
 
-	ut_a(lock->magic_n == RW_LOCK_MAGIC_N);
+	ut_ad(lock->magic_n == RW_LOCK_MAGIC_N);
 	ut_a(waiters == 0 || waiters == 1);
 	ut_a(lock_word > -X_LOCK_DECR ||(-lock_word) % X_LOCK_DECR == 0);
 

Attachment: [text/bzr-bundle] bzr/marko.makela@oracle.com-20100601140355-u3kxl0yl0ljl5tx9.bundle
Thread
bzr commit into mysql-trunk-innodb branch (marko.makela:3133) marko.makela1 Jun