ensure that ref_rw cannot change underneath

This commit is contained in:
Thomas Schoebel-Theuer 2012-02-08 09:52:00 +01:00 committed by Thomas Schoebel-Theuer
parent c122773d6a
commit 22cc0f8fef
2 changed files with 6 additions and 3 deletions

View File

@ -964,13 +964,13 @@ void wb_endio(struct generic_callback *cb)
brick = wb->w_brick;
CHECK_PTR(brick, err);
atomic_dec(&brick->wb_balance_count);
if (cb->cb_error < 0) {
wb->w_error = cb->cb_error;
}
rw = sub_mref->ref_rw;
atomic_dec(&brick->wb_balance_count);
rw = sub_mref_a->orig_rw;
dec = rw ? &wb->w_sub_write_count : &wb->w_sub_read_count;
CHECK_ATOMIC(dec, 1);
if (!atomic_dec_and_test(dec)) {
@ -1075,6 +1075,7 @@ struct writeback_info *make_writeback(struct trans_logger_brick *brick, loff_t p
sub_mref_a->my_input = read_input;
sub_mref_a->log_input = log_input;
sub_mref_a->my_brick = brick;
sub_mref_a->orig_rw = READ;
sub_mref_a->wb = wb;
status = GENERIC_INPUT_CALL(read_input, mref_get, sub_mref);
@ -1146,6 +1147,7 @@ struct writeback_info *make_writeback(struct trans_logger_brick *brick, loff_t p
sub_mref_a->my_input = write_input;
sub_mref_a->log_input = log_input;
sub_mref_a->my_brick = brick;
sub_mref_a->orig_rw = WRITE;
sub_mref_a->wb = wb;
status = GENERIC_INPUT_CALL(write_input, mref_get, sub_mref);

View File

@ -89,6 +89,7 @@ struct trans_logger_mref_aspect {
struct trans_logger_mref_aspect *shadow_ref;
struct trans_logger_mref_aspect *orig_mref_a;
void *shadow_data;
int orig_rw;
bool do_dealloc;
bool do_buffered;
bool is_hashed;