diff -rup mysql-5.1.55_base/storage/innodb_plugin/fil/fil0fil.c mysql-5.1.55_test/storage/innodb_plugin/fil/fil0fil.c --- mysql-5.1.55_base/storage/innodb_plugin/fil/fil0fil.c 2011-01-26 00:04:36.000000000 +0900 +++ mysql-5.1.55_test/storage/innodb_plugin/fil/fil0fil.c 2011-02-22 10:44:43.842776868 +0900 @@ -235,6 +235,7 @@ the ib_logfiles form a 'space' and it is struct fil_system_struct { #ifndef UNIV_HOTBACKUP mutex_t mutex; /*!< The mutex protecting the cache */ + mutex_t file_extend_mutex; #endif /* !UNIV_HOTBACKUP */ hash_table_t* spaces; /*!< The hash table of spaces in the system; they are hashed on the space @@ -1539,6 +1540,7 @@ fil_init( fil_system = mem_zalloc(sizeof(fil_system_t)); mutex_create(&fil_system->mutex, SYNC_ANY_LATCH); + mutex_create(&fil_system->file_extend_mutex, SYNC_OUTER_ANY_LATCH); fil_system->spaces = hash_create(hash_size); fil_system->name_hash = hash_create(hash_size); @@ -3855,6 +3857,10 @@ fil_extend_space_to_desired_size( ulint page_size; ibool success = TRUE; + /* file_extend_mutex is for http://bugs.mysql.com/56433 */ + /* to protect from the other fil_extend_space_to_desired_size() */ + /* during temprary releasing &fil_system->mutex */ + mutex_enter(&fil_system->file_extend_mutex); fil_mutex_enter_and_prepare_for_io(space_id); space = fil_space_get_by_id(space_id); @@ -3866,6 +3872,7 @@ fil_extend_space_to_desired_size( *actual_size = space->size; mutex_exit(&fil_system->mutex); + mutex_exit(&fil_system->file_extend_mutex); return(TRUE); } @@ -3898,6 +3905,8 @@ fil_extend_space_to_desired_size( offset_low = ((start_page_no - file_start_page_no) % (4096 * ((1024 * 1024) / page_size))) * page_size; + + mutex_exit(&fil_system->mutex); #ifdef UNIV_HOTBACKUP success = os_file_write(node->name, node->handle, buf, offset_low, offset_high, @@ -3909,6 +3918,8 @@ fil_extend_space_to_desired_size( page_size * n_pages, NULL, NULL); #endif + mutex_enter(&fil_system->mutex); + if (success) { node->size += n_pages; space->size += n_pages; @@ -3954,6 +3965,7 @@ fil_extend_space_to_desired_size( printf("Extended %s to %lu, actual size %lu pages\n", space->name, size_after_extend, *actual_size); */ mutex_exit(&fil_system->mutex); + mutex_exit(&fil_system->file_extend_mutex); fil_flush(space_id); diff -rup mysql-5.1.55_base/storage/innodb_plugin/include/sync0sync.h mysql-5.1.55_test/storage/innodb_plugin/include/sync0sync.h --- mysql-5.1.55_base/storage/innodb_plugin/include/sync0sync.h 2011-01-26 00:04:39.000000000 +0900 +++ mysql-5.1.55_test/storage/innodb_plugin/include/sync0sync.h 2011-02-22 10:44:43.843775855 +0900 @@ -490,6 +490,7 @@ or row lock! */ #define SYNC_BUF_POOL 150 #define SYNC_BUF_BLOCK 149 #define SYNC_DOUBLEWRITE 140 +#define SYNC_OUTER_ANY_LATCH 136 #define SYNC_ANY_LATCH 135 #define SYNC_THR_LOCAL 133 #define SYNC_MEM_HASH 131