]> git.baikalelectronics.ru Git - kernel.git/commit
dm snapshot: fix metadata corruption
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 3 Mar 2014 22:19:22 +0000 (17:19 -0500)
committerMike Snitzer <snitzer@redhat.com>
Mon, 3 Mar 2014 22:58:13 +0000 (17:58 -0500)
commit2a604565c0bb88fe6e0131654a579172fd8aa991
treebf738c96d1c98f6743abfcf4312449d9e021140d
parent4e4d35c5ca9c0d4768313254165e69a9ad37c01d
dm snapshot: fix metadata corruption

Commit b8d69b3dc511c9450 ("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 b8d69b3dc511c9450 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>
drivers/md/dm-snap-persistent.c