Bug 2048160

Summary: [RFE] LVM Thin: Support running thin_discard before activating a thin pool
Product: [Community] LVM and device-mapper Reporter: Demi Marie Obenour <demiobenour>
Component: lvm2Assignee: LVM Team <lvm-team>
lvm2 sub component: Activating existing Logical Volumes QA Contact: cluster-qe <cluster-qe>
Status: NEW --- Docs Contact:
Severity: unspecified    
Priority: unspecified CC: agk, heinzm, jbrassow, prajnoha, thornber, zkabelac
Version: unspecifiedFlags: pm-rhel: lvm-technical-solution?
pm-rhel: lvm-test-coverage?
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Demi Marie Obenour 2022-01-29 20:01:19 UTC
Description of problem:
To ensure that blocks freed by deleting a thin pool LV are discarded,
one must run blkdiscard on the thin pool LV before deleting it.  This
is slow and unreliable.  Instead, LVM could run thin_trim on the
metadata and data LVs before activating the pool.  This would
automatically discard all blocks in the pool that are no longer needed.

Version-Release number of selected component (if applicable):
This feature has not been implemented in any version of LVM2 to date.

How reproducible:
100%

Steps to Reproduce:

1. Have a system where thin pool LVs are frequently created and destroyed.
2. Try to figure out how to ensure that blocks used only by to-be-destroyed
   thin pool LVs are discarded.

Actual results:
There is no solution better than running blkdiscard on the LV before removing
it, which is slow, unreliable, and interferes with other I/O unless manually
chunked.

Expected results:
LVM2 can be configured to run thin_trim before activating the pool,
automatically discarding the unneeded blocks.

Additional info:
Linux currently implements on a thin pool LV inefficiently,
which is one reason that this is a problem in practice.

Comment 1 Demi Marie Obenour 2022-01-29 20:06:06 UTC
This is likely to be significant for those who use LVM thin provisioning on
top of VDO, as VDO is itself a form of thin provisioning and requires discards
to be passed down from upper layers.