[thin_generate_damage] Do not open a new transaction to prevent ref-count underflow
There's a chance that thin_generate_damage tries to change ref-counts of space map blocks due to its random nature, which could lead to problems. If the ref-counts of metadata space map blocks (shadow source) is changed to zero, then the ref-counts will become underflow after a shadow operation. In-place space map modification is a way to prevent that value underflow. An alternative approach is to avoid changing ref-counts of space map blocks.
This commit is contained in:
		| @@ -63,6 +63,14 @@ void damage_generator::create_metadata_leaks(block_address nr_leaks, | |||||||
| 	std::set<block_address> leaks; | 	std::set<block_address> leaks; | ||||||
| 	find_blocks(md_->metadata_sm_, nr_leaks, expected, leaks); | 	find_blocks(md_->metadata_sm_, nr_leaks, expected, leaks); | ||||||
|  |  | ||||||
|  | 	block_counter bc(true); | ||||||
|  | 	md_->metadata_sm_->count_metadata(bc); | ||||||
|  | 	block_address nr_blocks = md_->metadata_sm_->get_nr_blocks(); | ||||||
|  | 	for (block_address b = 0; b < nr_blocks; b++) { | ||||||
|  | 		if (bc.get_count(b)) | ||||||
|  | 			md_->tm_->mark_shadowed(b); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	for (auto const &b : leaks) | 	for (auto const &b : leaks) | ||||||
| 		md_->metadata_sm_->set_count(b, actual); | 		md_->metadata_sm_->set_count(b, actual); | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user