Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm log: introduce flush_failed variable

Introduce "flush failed" variable. When a flush before clearing a bit
in the log fails, we don't know anything about which which regions are
in-sync and which not.

So we need to set all regions as not-in-sync and set the variable
"flush_failed" to prevent setting the in-sync bit in the future.

A target reload is the only way to get out of this situation.

The variable will be set in following patches.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>

authored by

Mikulas Patocka and committed by
Alasdair G Kergon
5adc78d0 20a34a8e

+4 -1
+4 -1
drivers/md/dm-log.c
··· 210 210 struct dm_target *ti; 211 211 int touched_dirtied; 212 212 int touched_cleaned; 213 + int flush_failed; 213 214 uint32_t region_size; 214 215 unsigned int region_count; 215 216 region_t sync_count; ··· 395 394 lc->ti = ti; 396 395 lc->touched_dirtied = 0; 397 396 lc->touched_cleaned = 0; 397 + lc->flush_failed = 0; 398 398 lc->region_size = region_size; 399 399 lc->region_count = region_count; 400 400 lc->sync = sync; ··· 708 706 static void core_clear_region(struct dm_dirty_log *log, region_t region) 709 707 { 710 708 struct log_c *lc = (struct log_c *) log->context; 711 - log_set_bit(lc, lc->clean_bits, region); 709 + if (likely(!lc->flush_failed)) 710 + log_set_bit(lc, lc->clean_bits, region); 712 711 } 713 712 714 713 static int core_get_resync_work(struct dm_dirty_log *log, region_t *region)