dm thin: complete writes only after the metadata commit
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | dm thin metadata: report uncommitted state and refuse commits after a failuredrivers/ drivers/ | +68 | 0 replies | |
| 2/2 | dm thin: add wait_for_commit pool featureDocumentation/ drivers/ | +122 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] dm thin: complete writes only after the metadata commit
This series adds a new option to the dm thin pool: wait_for_commit. When wait_for_commit is enabled, a write or a discard will return after the metadata is committed. By default, wait_for_commit is disabled, and the thin pool behaves exactly as before.
Why we need wait_for_commit:
Assume there is a server A, and the underlying device of its thin pool is an NVMe-oF device. Server A creates a thin device and exports the thin device to a remote host via NVMe-oF too. When server A fails, a control plane will rebuild the pool and thin device on a standby server B, and server B will export the thin device to the same remote host. When the remote host issues a FLUSH, server A fails, so the metadata are not committed to the pool. The thin pool fails over to server B, and then the NVMe-oF multipath resends the FLUSH to B. B receives the command and finds nothing to flush. In this case, some uncommitted data are lost, but the remote host can't get any error.
As the dm thin pool doc says: "the thin-provisioning target behaves like a physical disk that has a volatile write cache". If the underlying disk of a thin pool is a remote disk and we want to fail over the thin pool from server A to server B, the "volatile write cache" is only on server A, and server B doesn't know about it, so we will get a consistency issue. The wait_for_commit option could fix this issue with a performance penalty.
Below is a performance test on my laptop. We got the results in a VM on loop devices.
1 MiB sequential first writes (no zero fill)
| | 1 job, depth 1 | 8 jobs, depth 8 | | | MiB/s | mean ms | p99 ms | MiB/s | mean ms | p99 ms | | no wait_for_commit | 1307 | 0.65 | 1.59 | 1596 | 39.7 | 276 | | with wait_for_commit | 131 | 7.57 | 17.7 | 776 | 78.2 | 148 |
4 KiB random writes, mostly to new blocks (allocation and zero fill)
| | 1 job, depth 1, 2000 writes | 8 jobs, depth 2, 10000 writes | | | s | IOPS | p99 ms | s | IOPS | p99 ms | | no wait_for_commit | 1.16 | 1723 | 0.97 | 4.96 | 2066 | 15.3 | | with wait_for_commit | 10.5 | 195 | 11.6 | 15.1 | 673 | 49.5 |
4 KiB random overwrites of mapped blocks, 4 jobs, depth 16
| | IOPS | mean ms | p99 ms | | no wait_for_commit | 202095 | 0.31 | 1.12 | | with wait_for_commit | 203293 | 0.31 | 1.13 |
Peng Yu (2):
dm thin metadata: report uncommitted state and refuse commits after a
failure
dm thin: add wait_for_commit pool feature
.../device-mapper/thin-provisioning.rst | 25 +++- drivers/md/dm-thin-metadata.c | 61 +++++++-- drivers/md/dm-thin-metadata.h | 14 +++ drivers/md/dm-thin.c | 116 +++++++++++++++--- 4 files changed, 190 insertions(+), 26 deletions(-)
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
Signature · 1 line
2.43.0