From dbf253275ffdede5c499bbfeee4aa7f94ab6037d Mon Sep 17 00:00:00 2001 From: Sears Russell Date: Thu, 21 Jan 2010 20:27:35 +0000 Subject: [PATCH] fix nested top action log race; because of a refactoring mistake, it was releasing a mutex without acquiring it... --- src/stasis/logger/logger2.c | 2 +- src/stasis/transactional2.c | 5 +---- stasis/logger/logger2.h | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/stasis/logger/logger2.c b/src/stasis/logger/logger2.c index 4b5f879..38eb847 100644 --- a/src/stasis/logger/logger2.c +++ b/src/stasis/logger/logger2.c @@ -113,7 +113,7 @@ LogEntry * stasis_log_write_update(stasis_log_t* log, stasis_transaction_table_e return e; } // XXX change nta interface so that arg gets passed into end_nta, not begin_nta. -LogEntry * stasis_log_begin_nta(stasis_log_t* log, stasis_transaction_table_entry_t * l, unsigned int op, +void * stasis_log_begin_nta(stasis_log_t* log, stasis_transaction_table_entry_t * l, unsigned int op, const byte * arg, size_t arg_size) { LogEntry * e = mallocScratchUpdateLogEntry(INVALID_LSN, l->prevLSN, l->xid, op, INVALID_PAGE, arg_size); memcpy(stasis_log_entry_update_args_ptr(e), arg, arg_size); diff --git a/src/stasis/transactional2.c b/src/stasis/transactional2.c index 4b3586d..c33b966 100644 --- a/src/stasis/transactional2.c +++ b/src/stasis/transactional2.c @@ -418,10 +418,7 @@ int TnestedTopAction(int xid, int op, const byte * dat, size_t datSize) { void * TbeginNestedTopAction(int xid, int op, const byte * dat, int datSize) { assert(xid >= 0); - LogEntry * e = stasis_log_begin_nta(stasis_log_file, stasis_transaction_table_get(stasis_transaction_table, xid), op, dat, datSize); - LogEntry * ret = malloc(sizeofLogEntry(stasis_log_file, e)); - memcpy(ret, e, sizeofLogEntry(stasis_log_file, e)); - stasis_log_file->write_entry_done(stasis_log_file, e); + void * ret = stasis_log_begin_nta(stasis_log_file, stasis_transaction_table_get(stasis_transaction_table, xid), op, dat, datSize); DEBUG("Begin Nested Top Action e->LSN: %ld\n", e->LSN); return ret; } diff --git a/stasis/logger/logger2.h b/stasis/logger/logger2.h index 9f1c8cc..49c19c6 100644 --- a/stasis/logger/logger2.h +++ b/stasis/logger/logger2.h @@ -327,7 +327,7 @@ lsn_t stasis_log_write_clr(stasis_log_t* log, const LogEntry * e); lsn_t stasis_log_write_dummy_clr(stasis_log_t* log, int xid, lsn_t prev_lsn); -LogEntry * stasis_log_begin_nta(stasis_log_t* log, stasis_transaction_table_entry_t * l, unsigned int op, +void * stasis_log_begin_nta(stasis_log_t* log, stasis_transaction_table_entry_t * l, unsigned int op, const byte * arg, size_t arg_size); lsn_t stasis_log_end_nta(stasis_log_t* log, stasis_transaction_table_entry_t * l, LogEntry * e); #endif