aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-log.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index 31dc33df95c..6b23631db5b 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -288,6 +288,19 @@ static int rw_header(struct log_c *lc, int rw)
288 return dm_io(&lc->io_req, 1, &lc->header_location, NULL); 288 return dm_io(&lc->io_req, 1, &lc->header_location, NULL);
289} 289}
290 290
291static int flush_header(struct log_c *lc)
292{
293 struct dm_io_region null_location = {
294 .bdev = lc->header_location.bdev,
295 .sector = 0,
296 .count = 0,
297 };
298
299 lc->io_req.bi_rw = WRITE_BARRIER;
300
301 return dm_io(&lc->io_req, 1, &null_location, NULL);
302}
303
291static int read_header(struct log_c *log) 304static int read_header(struct log_c *log)
292{ 305{
293 int r; 306 int r;
@@ -616,6 +629,8 @@ static int disk_resume(struct dm_dirty_log *log)
616 629
617 /* write the new header */ 630 /* write the new header */
618 r = rw_header(lc, WRITE); 631 r = rw_header(lc, WRITE);
632 if (!r)
633 r = flush_header(lc);
619 if (r) { 634 if (r) {
620 DMWARN("%s: Failed to write header on dirty region log device", 635 DMWARN("%s: Failed to write header on dirty region log device",
621 lc->log_dev->name); 636 lc->log_dev->name);
@@ -669,7 +684,13 @@ static int disk_flush(struct dm_dirty_log *log)
669 if (r) 684 if (r)
670 fail_log_device(lc); 685 fail_log_device(lc);
671 else { 686 else {
672 lc->touched_dirtied = 0; 687 if (lc->touched_dirtied) {
688 r = flush_header(lc);
689 if (r)
690 fail_log_device(lc);
691 else
692 lc->touched_dirtied = 0;
693 }
673 lc->touched_cleaned = 0; 694 lc->touched_cleaned = 0;
674 } 695 }
675 696