[PATCH] dm snapshot: fix data corruption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch 55494bf2947dccdf2d98b62374fea7365dfead84 broke snapshots. When
loading the list of exceptions, the old code read exception areas one by
one into ps->area and inserted the exceptions into the hash table. The
patch 55494bf2 changed it so that dm-bufio with prefetch is used to load
exceptions. It loads the exceptions correctly, but leaves ps->area
uninitialized. When a new exception is allocated, it is stored in this
uninitialized ps->area location and full ps->area is written to the disk.
This causes metadata corruption.

This patch fixes the bug by copying the last area that was read via
dm-bufio into ps->area.

Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>

---
 drivers/md/dm-snap-persistent.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-3.14-rc5/drivers/md/dm-snap-persistent.c
===================================================================
--- linux-3.14-rc5.orig/drivers/md/dm-snap-persistent.c	2014-03-03 22:42:32.000000000 +0100
+++ linux-3.14-rc5/drivers/md/dm-snap-persistent.c	2014-03-03 22:45:45.000000000 +0100
@@ -546,6 +546,9 @@ static int read_exceptions(struct pstore
 		r = insert_exceptions(ps, area, callback, callback_context,
 				      &full);
 
+		if (!full)
+			memcpy(ps->area, area, ps->store->chunk_size << SECTOR_SHIFT);
+
 		dm_bufio_release(bp);
 
 		dm_bufio_forget(client, chunk);

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux