From 5fe4a51cffcddbf19e706cf4492c2bb8d01944d5 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 4 Nov 2011 10:14:25 +0200 Subject: Fixed lp:884101 "Crash in check_table_is_closed with concurrent workload" storage/myisam/mi_dbug.c: Added mutex to protect open table list while traversing it --- storage/myisam/mi_dbug.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'storage/myisam') diff --git a/storage/myisam/mi_dbug.c b/storage/myisam/mi_dbug.c index ab85ece07ab..76d5d13fc5b 100644 --- a/storage/myisam/mi_dbug.c +++ b/storage/myisam/mi_dbug.c @@ -173,6 +173,7 @@ my_bool check_table_is_closed(const char *name, const char *where) DBUG_ENTER("check_table_is_closed"); (void) fn_format(filename,name,"",MI_NAME_IEXT,4+16+32); + pthread_mutex_lock(&THR_LOCK_myisam); for (pos=myisam_open_list ; pos ; pos=pos->next) { MI_INFO *info=(MI_INFO*) pos->data; @@ -183,10 +184,12 @@ my_bool check_table_is_closed(const char *name, const char *where) { fprintf(stderr,"Warning: Table: %s is open on %s\n", name,where); DBUG_PRINT("warning",("Table: %s is open on %s", name,where)); + pthread_mutex_unlock(&THR_LOCK_myisam); DBUG_RETURN(1); } } } + pthread_mutex_unlock(&THR_LOCK_myisam); DBUG_RETURN(0); } #endif /* EXTRA_DEBUG */ -- cgit v1.2.1