aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2014-03-03 17:19:22 -0500
committerMike Snitzer <snitzer@redhat.com>2014-03-03 17:58:13 -0500
commit2c945820cab96ebf265598d998e63ef22393d0d4 (patch)
treebf738c96d1c98f6743abfcf4312449d9e021140d /drivers/md
parentc64d240df31513522901539a3206a41e9e6d00c8 (diff)
dm snapshot: fix metadata corruption
Commit 55494bf2947dccdf2 ("dm snapshot: use dm-bufio") broke snapshots. Before that 3.14-rc1 commit, loading a snapshot's list of exceptions involved reading exception areas one by one into ps->area and inserting those exceptions into the hash table. Commit 55494bf2947dccdf2 changed it so that dm-bufio with prefetch is used to load exceptions in batchs. Exceptions are loaded correctly, but ps->area is left uninitialized. When a new exception is allocated, it is stored in this uninitialized ps->area which will be written to the disk. This causes metadata corruption. Fix this corruption by copying the last area that was read via dm-bufio into ps->area. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-snap-persistent.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
index afc3d017de4c..d6e88178d22c 100644
--- a/drivers/md/dm-snap-persistent.c
+++ b/drivers/md/dm-snap-persistent.c
@@ -546,6 +546,9 @@ static int read_exceptions(struct pstore *ps,
546 r = insert_exceptions(ps, area, callback, callback_context, 546 r = insert_exceptions(ps, area, callback, callback_context,
547 &full); 547 &full);
548 548
549 if (!full)
550 memcpy(ps->area, area, ps->store->chunk_size << SECTOR_SHIFT);
551
549 dm_bufio_release(bp); 552 dm_bufio_release(bp);
550 553
551 dm_bufio_forget(client, chunk); 554 dm_bufio_forget(client, chunk);