aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/dm-log.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index 666a80e3602e..315e36a96b6f 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -677,13 +677,26 @@ static int core_flush(struct dm_dirty_log *log)
677 677
678static int disk_flush(struct dm_dirty_log *log) 678static int disk_flush(struct dm_dirty_log *log)
679{ 679{
680 int r; 680 int r, i;
681 struct log_c *lc = (struct log_c *) log->context; 681 struct log_c *lc = log->context;
682 682
683 /* only write if the log has changed */ 683 /* only write if the log has changed */
684 if (!lc->touched_cleaned && !lc->touched_dirtied) 684 if (!lc->touched_cleaned && !lc->touched_dirtied)
685 return 0; 685 return 0;
686 686
687 if (lc->touched_cleaned && log->flush_callback_fn &&
688 log->flush_callback_fn(lc->ti)) {
689 /*
690 * At this point it is impossible to determine which
691 * regions are clean and which are dirty (without
692 * re-reading the log off disk). So mark all of them
693 * dirty.
694 */
695 lc->flush_failed = 1;
696 for (i = 0; i < lc->region_count; i++)
697 log_clear_bit(lc, lc->clean_bits, i);
698 }
699
687 r = rw_header(lc, WRITE); 700 r = rw_header(lc, WRITE);
688 if (r) 701 if (r)
689 fail_log_device(lc); 702 fail_log_device(lc);