Commit 8be7b615 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

protect the logger's n_in_buf variable by increasing the scope of the logger's...

protect the logger's n_in_buf variable by increasing the scope of the logger's input lock close[t:2015]

git-svn-id: file:///svn/toku/tokudb@14581 c7de825b-a66e-492c-adef-691d508d4ae1
parent 465065c6
...@@ -419,8 +419,6 @@ static int do_write (TOKULOGGER logger, int do_fsync) { ...@@ -419,8 +419,6 @@ static int do_write (TOKULOGGER logger, int do_fsync) {
struct logbytes *list = logger->head; struct logbytes *list = logger->head;
logger->head=logger->tail=0; logger->head=logger->tail=0;
logger->n_in_buf=0; logger->n_in_buf=0;
r=ml_unlock(&logger->input_lock); if (r!=0) goto panic;
logger->n_in_buf=0;
while (list) { while (list) {
if (logger->n_in_file + list->nbytes <= logger->lg_max) { if (logger->n_in_file + list->nbytes <= logger->lg_max) {
if (logger->n_in_buf + list->nbytes <= LOGGER_BUF_SIZE) { if (logger->n_in_buf + list->nbytes <= LOGGER_BUF_SIZE) {
...@@ -457,6 +455,7 @@ static int do_write (TOKULOGGER logger, int do_fsync) { ...@@ -457,6 +455,7 @@ static int do_write (TOKULOGGER logger, int do_fsync) {
r=write_it(logger->fd, logger->buf, logger->n_in_buf); r=write_it(logger->fd, logger->buf, logger->n_in_buf);
if (r!=logger->n_in_buf) { r=errno; goto panic; } if (r!=logger->n_in_buf) { r=errno; goto panic; }
logger->n_in_buf=0; logger->n_in_buf=0;
r=ml_unlock(&logger->input_lock); if (r!=0) goto panic2;
if (do_fsync) { if (do_fsync) {
if (logger->write_log_files) { if (logger->write_log_files) {
r = toku_os_fsync_function(logger->fd); assert(r == 0); r = toku_os_fsync_function(logger->fd); assert(r == 0);
...@@ -467,6 +466,8 @@ static int do_write (TOKULOGGER logger, int do_fsync) { ...@@ -467,6 +466,8 @@ static int do_write (TOKULOGGER logger, int do_fsync) {
toku_logfilemgr_update_last_lsn(logger->logfilemgr, logger->written_lsn); toku_logfilemgr_update_last_lsn(logger->logfilemgr, logger->written_lsn);
return 0; return 0;
panic: panic:
ml_unlock(&logger->input_lock);
panic2:
toku_logger_panic(logger, r); toku_logger_panic(logger, r);
return r; return r;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment