diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2020-01-08 18:46:05 +0300 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2020-01-15 04:22:48 +0300 |
commit | aa9509209c5ac2f0b35d01a922bf9ae072d0c2fc (patch) | |
tree | 14318a9079ca46a89fcb300586c2103dd0538ec1 /drivers/mmc | |
parent | 4ea9471fbd1addb25a4d269991dc724e200ca5b5 (diff) | |
download | linux-aa9509209c5ac2f0b35d01a922bf9ae072d0c2fc.tar.xz |
dm writecache: fix incorrect flush sequence when doing SSD mode commit
When committing state, the function writecache_flush does the following:
1. write metadata (writecache_commit_flushed)
2. flush disk cache (writecache_commit_flushed)
3. wait for data writes to complete (writecache_wait_for_ios)
4. increase superblock seq_count
5. write the superblock
6. flush disk cache
It may happen that at step 3, when we wait for some write to finish, the
disk may report the write as finished, but the write only hit the disk
cache and it is not yet stored in persistent storage. At step 5 we write
the superblock - it may happen that the superblock is written before the
write that we waited for in step 3. If the machine crashes, it may result
in incorrect data being returned after reboot.
In order to fix the bug, we must swap steps 2 and 3 in the above sequence,
so that we first wait for writes to complete and then flush the disk
cache.
Fixes: 48debafe4f2f ("dm: add writecache target")
Cc: stable@vger.kernel.org # 4.18+
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/mmc')
0 files changed, 0 insertions, 0 deletions