summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-log-userspace-transfer.h
diff options
context:
space:
mode:
authorNikos Tsironis <ntsironis@arrikto.com>2021-01-22 16:19:31 +0100
committerMike Snitzer <snitzer@redhat.com>2021-02-10 19:26:09 +0100
commit2099b145d77c1d53f5711f029c37cc537897cee6 (patch)
tree904f0857203c1d87bd52fdc7b9de56ddce5f4e6b /drivers/md/dm-log-userspace-transfer.h
parentdm era: Recover committed writeset after crash (diff)
downloadlinux-2099b145d77c1d53f5711f029c37cc537897cee6.tar.xz
linux-2099b145d77c1d53f5711f029c37cc537897cee6.zip
dm era: Update in-core bitset after committing the metadata
In case of a system crash, dm-era might fail to mark blocks as written in its metadata, although the corresponding writes to these blocks were passed down to the origin device and completed successfully. Consider the following sequence of events: 1. We write to a block that has not been yet written in the current era 2. era_map() checks the in-core bitmap for the current era and sees that the block is not marked as written. 3. The write is deferred for submission after the metadata have been updated and committed. 4. The worker thread processes the deferred write (process_deferred_bios()) and marks the block as written in the in-core bitmap, **before** committing the metadata. 5. The worker thread starts committing the metadata. 6. We do more writes that map to the same block as the write of step (1) 7. era_map() checks the in-core bitmap and sees that the block is marked as written, **although the metadata have not been committed yet**. 8. These writes are passed down to the origin device immediately and the device reports them as completed. 9. The system crashes, e.g., power failure, before the commit from step (5) finishes. When the system recovers and we query the dm-era target for the list of written blocks it doesn't report the aforementioned block as written, although the writes of step (6) completed successfully. The issue is that era_map() decides whether to defer or not a write based on non committed information. The root cause of the bug is that we update the in-core bitmap, **before** committing the metadata. Fix this by updating the in-core bitmap **after** successfully committing the metadata. Fixes: eec40579d84873 ("dm: add era target") Cc: stable@vger.kernel.org # v3.15+ Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-log-userspace-transfer.h')
0 files changed, 0 insertions, 0 deletions