From: Mikulas Patocka Date: Tue, 2 Aug 2011 11:32:00 +0000 (+0100) Subject: dm snapshot: flush disk cache when merging X-Git-Tag: firefly_0821_release~7541^2~3025 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b41ed9c38a42daa4b474ebf18eb06ef1f17351f5;p=firefly-linux-kernel-4.4.55.git dm snapshot: flush disk cache when merging commit 762a80d9fc9f690a3a35983f3b4619a220650808 upstream. This patch makes dm-snapshot flush disk cache when writing metadata for merging snapshot. Without cache flushing the disk may reorder metadata write and other data writes and there is a possibility of data corruption in case of power fault. Signed-off-by: Mikulas Patocka Signed-off-by: Alasdair G Kergon Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c index 135c2f1fdbfc..e4ecadf0548a 100644 --- a/drivers/md/dm-snap-persistent.c +++ b/drivers/md/dm-snap-persistent.c @@ -753,7 +753,7 @@ static int persistent_commit_merge(struct dm_exception_store *store, for (i = 0; i < nr_merged; i++) clear_exception(ps, ps->current_committed - 1 - i); - r = area_io(ps, WRITE); + r = area_io(ps, WRITE_FLUSH_FUA); if (r < 0) return r;